home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 10 / BBS In A Box Volume X (AMUG) (January 1994).bin / Files / Prog / U-Z / VideoToolBox.cpt / VideoToolboxSources / ReadAssignments.c < prev    next >
MacBinary  |  1993-03-04  |  21.0 KB  |  [TEXT/KAHL]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Thu Mar 4 11:53:02 1993, modified Thu Mar 4 11:53:02 1993, creator Think C, type ASCII, 20776 bytes "ReadAssignments.c" , at 0x51a8 428 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[KAHL]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 11 52 65 61 64 41 73 | 73 69 67 6e 6d 65 6e 74 |..ReadAs|signment|
|00000010| 73 2e 63 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |s.c.....|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4b 41 48 | 4c 01 00 00 00 00 00 00 |.TEXTKAH|L.......|
|00000050| 00 00 00 00 00 51 28 00 | 00 01 ac a7 bb e4 6e a7 |.....Q(.|......n.|
|00000060| bb e4 6e 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |..n.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 ac 5f 00 00 |........|....._..|
|00000080| 23 69 66 20 30 0d 52 65 | 61 64 41 73 73 69 67 6e |#if 0.Re|adAssign|
|00000090| 6d 65 6e 74 73 2e 63 0d | 54 68 69 73 20 69 73 20 |ments.c.|This is |
|000000a0| 61 20 72 75 6e 74 69 6d | 65 20 43 20 69 6e 74 65 |a runtim|e C inte|
|000000b0| 72 70 72 65 74 65 72 20 | 74 68 61 74 20 6f 6e 6c |rpreter |that onl|
|000000c0| 79 20 61 63 63 65 70 74 | 73 20 61 73 73 69 67 6e |y accept|s assign|
|000000d0| 6d 65 6e 74 73 20 61 6e | 64 20 63 6f 6d 6d 65 6e |ments an|d commen|
|000000e0| 74 73 2c 20 65 2e 67 2e | 0d 0d 09 2f 2a 20 43 20 |ts, e.g.|.../* C |
|000000f0| 63 6f 6d 6d 65 6e 74 20 | 2a 2f 0d 09 2f 2f 20 43 |comment |*/..// C|
|00000100| 2b 2b 20 63 6f 6d 6d 65 | 6e 74 0d 09 70 75 70 69 |++ comme|nt..pupi|
|00000110| 6c 4d 6d 3d 32 2e 30 3b | 0d 09 6c 6f 67 43 3d 2d |lMm=2.0;|..logC=-|
|00000120| 49 4e 46 3b 09 0d 09 76 | 69 65 77 69 6e 67 44 69 |INF;...v|iewingDi|
|00000130| 73 74 61 6e 63 65 3d 35 | 37 2e 30 3b 0d 2f 2f 09 |stance=5|7.0;.//.|
|00000140| 72 65 73 75 6c 74 3d 30 | 3b 09 0d 09 72 65 73 75 |result=0|;...resu|
|00000150| 6c 74 20 3d 20 4e 41 4e | 3b 0d 09 74 72 69 61 6c |lt = NAN|;..trial|
|00000160| 73 3d 34 30 3b 09 09 09 | 09 2f 2f 20 73 68 6f 72 |s=40;...|.// shor|
|00000170| 74 20 69 6e 74 2c 20 6f | 72 20 63 68 61 72 20 6f |t int, o|r char o|
|00000180| 72 20 6c 6f 6e 67 2c 20 | 73 69 67 6e 65 64 20 6f |r long, |signed o|
|00000190| 72 20 75 6e 73 69 67 6e | 65 64 0d 09 2f 2f 20 54 |r unsign|ed..// T|
|000001a0| 68 65 20 6e 65 78 74 20 | 6c 69 6e 65 20 69 73 20 |he next |line is |
|000001b0| 62 6c 61 6e 6b 2c 20 73 | 65 70 61 72 61 74 69 6e |blank, s|eparatin|
|000001c0| 67 20 22 62 6c 6f 63 6b | 73 22 20 6f 66 20 61 73 |g "block|s" of as|
|000001d0| 73 69 67 6e 6d 65 6e 74 | 73 0d 09 0d 09 6c 6f 67 |signment|s....log|
|000001e0| 43 3d 2d 31 3b 09 0d 09 | 74 72 69 61 6c 73 3d 27 |C=-1;...|trials='|
|000001f0| 45 27 3b 0d 09 6b 69 6e | 64 4f 66 54 72 69 61 6c |E';..kin|dOfTrial|
|00000200| 3d 22 32 49 46 43 22 3b | 09 09 2f 2a 20 73 74 72 |="2IFC";|../* str|
|00000210| 69 6e 67 20 2a 2f 0d 09 | 6d 65 73 73 61 67 65 3d |ing */..|message=|
|00000220| 22 49 20 77 69 6c 6c 20 | 62 65 65 70 5c 30 30 37 |"I will |beep\007|
|00000230| 20 6e 6f 77 2e 5c 6e 22 | 3b 0d 09 0d 57 68 69 74 | now.\n"|;...Whit|
|00000240| 65 73 70 61 63 65 20 61 | 6e 64 20 63 6f 6d 6d 65 |espace a|nd comme|
|00000250| 6e 74 73 20 61 72 65 20 | 69 67 6e 6f 72 65 64 20 |nts are |ignored |
|00000260| 28 65 78 63 65 70 74 20 | 74 68 61 74 20 79 6f 75 |(except |that you|
|00000270| 20 63 61 6e 20 62 72 65 | 61 6b 20 6f 66 66 20 70 | can bre|ak off p|
|00000280| 72 6f 63 65 73 73 69 6e | 67 20 61 74 0d 65 6e 64 |rocessin|g at.end|
|00000290| 73 20 6f 66 20 6c 69 6e | 65 73 2c 20 61 6e 64 20 |s of lin|es, and |
|000002a0| 62 6c 6f 63 6b 73 20 73 | 65 70 61 72 61 74 65 64 |blocks s|eparated|
|000002b0| 20 62 79 20 62 6c 61 6e | 6b 20 6c 69 6e 65 73 29 | by blan|k lines)|
|000002c0| 2e 20 42 6f 74 68 20 43 | 20 73 74 79 6c 65 20 2f |. Both C| style /|
|000002d0| 2a 20 2a 2f 20 61 6e 64 | 20 43 2b 2b 0d 73 74 79 |* */ and| C++.sty|
|000002e0| 6c 65 20 2f 2f 20 63 6f | 6d 6d 65 6e 74 73 20 61 |le // co|mments a|
|000002f0| 72 65 20 61 6c 6c 6f 77 | 65 64 2e 20 4e 6f 20 65 |re allow|ed. No e|
|00000300| 78 70 72 65 73 73 69 6f | 6e 20 65 76 61 6c 75 61 |xpressio|n evalua|
|00000310| 74 69 6f 6e 20 69 73 20 | 73 75 70 70 6f 72 74 65 |tion is |supporte|
|00000320| 64 20 62 65 79 6f 6e 64 | 0d 73 69 6d 70 6c 65 20 |d beyond|.simple |
|00000330| 72 65 61 64 69 6e 67 20 | 6f 66 20 76 61 6c 75 65 |reading |of value|
|00000340| 73 2e 20 4e 6f 20 63 61 | 73 74 73 2c 20 65 2e 67 |s. No ca|sts, e.g|
|00000350| 2e 20 28 75 6e 73 69 67 | 6e 65 64 20 6c 6f 6e 67 |. (unsig|ned long|
|00000360| 29 2c 20 6e 75 6d 62 65 | 72 20 73 75 66 66 69 78 |), numbe|r suffix|
|00000370| 65 73 2c 20 65 2e 67 2e | 0d 55 4c 2c 20 6f 72 20 |es, e.g.|.UL, or |
|00000380| 70 72 65 70 72 6f 70 72 | 6f 63 65 73 73 6f 72 20 |prepropr|ocessor |
|00000390| 64 69 72 65 63 74 69 76 | 65 73 2c 20 65 2e 67 2e |directiv|es, e.g.|
|000003a0| 20 23 69 66 2c 20 61 72 | 65 20 61 6c 6c 6f 77 65 | #if, ar|e allowe|
|000003b0| 64 2e 20 41 64 6a 61 63 | 65 6e 74 20 73 74 72 69 |d. Adjac|ent stri|
|000003c0| 6e 67 73 20 61 72 65 0d | 63 6f 6e 63 61 74 65 6e |ngs are.|concaten|
|000003d0| 61 74 65 64 2c 20 61 73 | 20 73 70 65 63 69 66 69 |ated, as| specifi|
|000003e0| 65 64 20 62 79 20 41 4e | 53 49 20 43 2e 20 42 61 |ed by AN|SI C. Ba|
|000003f0| 63 6b 73 6c 61 73 68 20 | 65 73 63 61 70 65 73 2c |ckslash |escapes,|
|00000400| 20 65 2e 67 2e 20 5c 30 | 30 37 2c 20 77 69 74 68 | e.g. \0|07, with|
|00000410| 69 6e 0d 73 69 6e 67 6c | 65 20 61 6e 64 20 64 6f |in.singl|e and do|
|00000420| 75 62 6c 65 20 71 75 6f | 74 65 73 20 61 72 65 20 |uble quo|tes are |
|00000430| 66 75 6c 6c 79 20 73 75 | 70 70 6f 72 74 65 64 2e |fully su|pported.|
|00000440| 20 43 6f 6e 74 69 6e 75 | 69 6e 67 20 61 20 6c 69 | Continu|ing a li|
|00000450| 6e 65 20 62 79 20 70 75 | 74 74 69 6e 67 20 61 0d |ne by pu|tting a.|
|00000460| 62 61 63 6b 73 6c 61 73 | 68 20 6a 75 73 74 20 62 |backslas|h just b|
|00000470| 65 66 6f 72 65 20 74 68 | 65 20 6e 65 77 6c 69 6e |efore th|e newlin|
|00000480| 65 20 63 68 61 72 61 63 | 74 65 72 20 69 73 20 6e |e charac|ter is n|
|00000490| 6f 74 20 73 75 70 70 6f | 72 74 65 64 2e 20 45 61 |ot suppo|rted. Ea|
|000004a0| 63 68 20 73 74 72 69 6e | 67 20 69 73 0d 61 6c 6c |ch strin|g is.all|
|000004b0| 6f 63 61 74 65 64 20 6f | 6e 20 74 68 65 20 68 65 |ocated o|n the he|
|000004c0| 61 70 2c 20 62 79 20 6d | 61 6c 6c 6f 63 28 29 2e |ap, by m|alloc().|
|000004d0| 20 59 6f 75 20 63 61 6e | 20 72 65 63 6f 76 65 72 | You can| recover|
|000004e0| 20 74 68 65 20 73 70 61 | 63 65 20 61 73 73 69 67 | the spa|ce assig|
|000004f0| 6e 65 64 20 74 6f 20 61 | 0d 73 74 72 69 6e 67 20 |ned to a|.string |
|00000500| 62 79 20 63 61 6c 6c 69 | 6e 67 20 66 72 65 65 28 |by calli|ng free(|
|00000510| 29 2e 0d 0d 54 68 69 73 | 20 43 20 69 6e 74 65 72 |)...This| C inter|
|00000520| 70 72 65 74 65 72 20 69 | 73 20 71 75 69 74 65 20 |preter i|s quite |
|00000530| 64 75 6d 62 20 61 6e 64 | 20 76 65 72 79 20 73 74 |dumb and| very st|
|00000540| 72 69 63 74 2e 20 49 66 | 20 69 74 20 63 61 6e 27 |rict. If| it can'|
|00000550| 74 20 69 6e 74 65 72 70 | 72 65 74 20 79 6f 75 72 |t interp|ret your|
|00000560| 0d 66 69 6c 65 20 69 74 | 20 77 69 6c 6c 20 50 72 |.file it| will Pr|
|00000570| 69 6e 74 66 45 78 69 74 | 20 61 6e 20 65 72 72 6f |intfExit| an erro|
|00000580| 72 20 6d 65 73 73 61 67 | 65 20 70 69 6e 70 6f 69 |r messag|e pinpoi|
|00000590| 6e 74 69 6e 67 20 74 68 | 65 20 65 72 72 6f 72 2e |nting th|e error.|
|000005a0| 0d 41 73 73 69 67 6e 6d | 65 6e 74 20 73 74 61 74 |.Assignm|ent stat|
|000005b0| 65 6d 65 6e 74 73 20 6d | 75 73 74 20 62 65 20 74 |ements m|ust be t|
|000005c0| 65 72 6d 69 6e 61 74 65 | 64 20 62 79 20 73 65 6d |erminate|d by sem|
|000005d0| 69 63 6f 6c 6f 6e 73 2e | 20 43 6f 6d 6d 65 6e 74 |icolons.| Comment|
|000005e0| 73 20 6f 70 65 6e 65 64 | 2c 20 2f 2a 2c 0d 6d 75 |s opened|, /*,.mu|
|000005f0| 73 74 20 62 65 20 63 6c | 6f 73 65 64 2c 20 2a 2f |st be cl|osed, */|
|00000600| 2e 0d 0d 54 68 65 20 6d | 61 69 6e 20 75 73 65 20 |...The m|ain use |
|00000610| 6f 66 20 74 68 65 73 65 | 20 72 6f 75 74 69 6e 65 |of these| routine|
|00000620| 73 20 77 69 6c 6c 20 62 | 65 20 74 6f 20 72 65 61 |s will b|e to rea|
|00000630| 64 20 70 61 72 61 6d 65 | 74 65 72 20 66 69 6c 65 |d parame|ter file|
|00000640| 73 20 74 68 61 74 20 63 | 6f 6e 74 72 6f 6c 0d 65 |s that c|ontrol.e|
|00000650| 78 70 65 72 69 6d 65 6e | 74 73 2e 20 54 79 70 69 |xperimen|ts. Typi|
|00000660| 63 61 6c 20 70 73 79 63 | 68 6f 70 68 79 73 69 63 |cal psyc|hophysic|
|00000670| 61 6c 20 61 6e 64 20 70 | 68 79 73 69 6f 6c 6f 67 |al and p|hysiolog|
|00000680| 69 63 61 6c 20 65 78 70 | 65 72 69 6d 65 6e 74 73 |ical exp|eriments|
|00000690| 20 61 72 65 20 56 45 52 | 59 0d 63 6f 6d 70 6c 69 | are VER|Y.compli|
|000006a0| 63 61 74 65 64 20 61 6e | 64 20 72 65 71 75 69 72 |cated an|d requir|
|000006b0| 65 20 6c 6f 74 73 20 6f | 66 20 61 64 6a 75 73 74 |e lots o|f adjust|
|000006c0| 61 62 6c 65 20 70 61 72 | 61 6d 65 74 65 72 73 2e |able par|ameters.|
|000006d0| 20 4f 6e 65 20 6e 65 65 | 64 73 20 61 6e 20 65 61 | One nee|ds an ea|
|000006e0| 73 79 20 77 61 79 20 74 | 6f 0d 63 68 61 6e 67 65 |sy way t|o.change|
|000006f0| 20 74 68 65 6d 20 61 6c | 6c 20 74 68 61 74 20 69 | them al|l that i|
|00000700| 73 20 73 65 6c 66 20 64 | 6f 63 75 6d 65 6e 74 69 |s self d|ocumenti|
|00000710| 6e 67 20 61 6e 64 20 65 | 61 73 69 6c 79 20 72 65 |ng and e|asily re|
|00000720| 70 72 6f 64 75 63 65 64 | 2c 20 70 6f 73 73 69 62 |produced|, possib|
|00000730| 6c 79 20 6d 6f 6e 74 68 | 73 0d 6c 61 74 65 72 2e |ly month|s.later.|
|00000740| 20 54 68 65 20 72 6f 75 | 74 69 6e 65 73 20 70 72 | The rou|tines pr|
|00000750| 6f 76 69 64 65 64 20 68 | 65 72 65 20 63 6f 6d 65 |ovided h|ere come|
|00000760| 20 69 6e 20 76 61 72 69 | 6f 75 73 20 66 6c 61 76 | in vari|ous flav|
|00000770| 6f 72 73 20 61 6c 6c 6f | 77 69 6e 67 20 79 6f 75 |ors allo|wing you|
|00000780| 20 74 6f 20 72 65 61 64 | 20 61 0d 6c 69 6e 65 20 | to read| a.line |
|00000790| 61 74 20 61 20 74 69 6d | 65 20 28 77 69 74 68 20 |at a tim|e (with |
|000007a0| 61 6e 79 20 6e 75 6d 62 | 65 72 20 6f 66 20 61 73 |any numb|er of as|
|000007b0| 73 69 67 6e 6d 65 6e 74 | 73 20 6f 6e 20 74 68 65 |signment|s on the|
|000007c0| 20 6c 69 6e 65 29 2c 20 | 61 20 62 6c 6f 63 6b 20 | line), |a block |
|000007d0| 61 74 20 61 20 74 69 6d | 65 0d 28 62 6c 6f 63 6b |at a tim|e.(block|
|000007e0| 73 20 61 72 65 20 73 65 | 70 61 72 61 74 65 64 20 |s are se|parated |
|000007f0| 62 79 20 62 6c 61 6e 6b | 20 6c 69 6e 65 73 29 2c |by blank| lines),|
|00000800| 20 6f 72 20 61 20 77 68 | 6f 6c 65 20 66 69 6c 65 | or a wh|ole file|
|00000810| 20 61 74 20 61 20 74 69 | 6d 65 2e 20 49 6e 20 63 | at a ti|me. In c|
|00000820| 6f 6e 74 72 6f 6c 6c 69 | 6e 67 0d 70 73 79 63 68 |ontrolli|ng.psych|
|00000830| 6f 70 68 79 73 69 63 61 | 6c 20 65 78 70 65 72 69 |ophysica|l experi|
|00000840| 6d 65 6e 74 73 20 49 20 | 75 73 65 20 61 20 62 6c |ments I |use a bl|
|00000850| 6f 63 6b 20 61 74 20 74 | 68 65 20 62 65 67 69 6e |ock at t|he begin|
|00000860| 6e 69 6e 67 20 6f 66 20 | 74 68 65 20 66 69 6c 65 |ning of |the file|
|00000870| 20 74 6f 20 64 65 66 69 | 6e 65 0d 74 68 65 20 67 | to defi|ne.the g|
|00000880| 65 6e 65 72 61 6c 20 65 | 78 70 65 72 69 6d 65 6e |eneral e|xperimen|
|00000890| 74 20 66 6f 6c 6c 6f 77 | 65 64 20 62 79 20 61 20 |t follow|ed by a |
|000008a0| 62 6c 6f 63 6b 20 66 6f | 72 20 65 61 63 68 20 70 |block fo|r each p|
|000008b0| 73 79 63 68 6f 70 68 79 | 73 69 63 61 6c 0d 22 62 |sychophy|sical."b|
|000008c0| 6c 6f 63 6b 22 2c 20 77 | 69 74 68 20 61 20 6c 69 |lock", w|ith a li|
|000008d0| 6e 65 20 66 6f 72 20 65 | 61 63 68 20 63 6f 6e 64 |ne for e|ach cond|
|000008e0| 69 74 69 6f 6e 2e 0d 0d | 53 69 6e 63 65 20 74 68 |ition...|Since th|
|000008f0| 65 20 69 6e 74 65 72 70 | 72 65 74 65 72 20 77 69 |e interp|reter wi|
|00000900| 6c 6c 20 66 61 69 6c 20 | 69 66 20 74 68 65 20 70 |ll fail |if the p|
|00000910| 61 72 61 6d 61 74 65 72 | 20 66 69 6c 65 20 63 6f |aramater| file co|
|00000920| 6e 74 61 69 6e 73 20 65 | 76 65 6e 20 61 20 73 69 |ntains e|ven a si|
|00000930| 6e 67 6c 65 0d 65 72 72 | 6f 72 2c 20 69 74 20 69 |ngle.err|or, it i|
|00000940| 73 20 73 74 72 6f 6e 67 | 6c 79 20 73 75 67 67 65 |s strong|ly sugge|
|00000950| 73 74 65 64 20 74 68 61 | 74 20 79 6f 75 72 20 65 |sted tha|t your e|
|00000960| 78 70 65 72 69 6d 65 6e | 74 61 6c 20 70 72 6f 67 |xperimen|tal prog|
|00000970| 72 61 6d 20 62 65 67 69 | 6e 20 62 79 20 64 6f 69 |ram begi|n by doi|
|00000980| 6e 67 20 61 0d 64 72 79 | 20 72 75 6e 2c 20 72 65 |ng a.dry| run, re|
|00000990| 61 64 69 6e 67 20 74 68 | 65 20 77 68 6f 6c 65 20 |ading th|e whole |
|000009a0| 66 69 6c 65 20 74 68 72 | 6f 75 67 68 20 74 6f 20 |file thr|ough to |
|000009b0| 63 68 65 63 6b 20 66 6f | 72 20 65 72 72 6f 72 73 |check fo|r errors|
|000009c0| 2c 20 62 65 66 6f 72 65 | 20 69 6e 69 74 69 61 6c |, before| initial|
|000009d0| 69 7a 69 6e 67 0d 79 6f | 75 72 20 76 61 72 69 61 |izing.yo|ur varia|
|000009e0| 62 6c 65 73 20 61 6e 64 | 20 72 65 61 64 69 6e 67 |bles and| reading|
|000009f0| 20 69 74 20 61 67 61 69 | 6e 20 61 20 62 69 74 20 | it agai|n a bit |
|00000a00| 61 74 20 61 20 74 69 6d | 65 20 61 73 20 74 68 65 |at a tim|e as the|
|00000a10| 20 65 78 70 65 72 69 6d | 65 6e 74 0d 70 72 6f 67 | experim|ent.prog|
|00000a20| 72 65 73 73 65 73 2e 20 | 49 74 20 77 6f 75 6c 64 |resses. |It would|
|00000a30| 20 6f 62 76 69 6f 75 73 | 6c 79 20 62 65 20 76 65 | obvious|ly be ve|
|00000a40| 72 79 20 62 61 64 20 74 | 6f 20 68 61 76 65 20 74 |ry bad t|o have t|
|00000a50| 68 65 20 69 6e 74 65 72 | 70 72 65 74 65 72 20 71 |he inter|preter q|
|00000a60| 75 69 74 20 6e 65 61 72 | 20 74 68 65 0d 65 6e 64 |uit near| the.end|
|00000a70| 20 6f 66 20 61 20 33 20 | 68 6f 75 72 20 65 78 70 | of a 3 |hour exp|
|00000a80| 65 72 69 6d 65 6e 74 2e | 0d 0d 54 68 65 20 69 6e |eriment.|..The in|
|00000a90| 74 65 72 70 72 65 74 65 | 72 20 75 73 65 73 20 61 |terprete|r uses a|
|00000aa0| 20 6c 69 6e 65 20 62 75 | 66 66 65 72 20 6f 66 20 | line bu|ffer of |
|00000ab0| 42 55 46 46 45 52 5f 53 | 49 5a 45 20 62 79 74 65 |BUFFER_S|IZE byte|
|00000ac0| 73 20 28 63 75 72 72 65 | 6e 74 6c 79 20 35 31 32 |s (curre|ntly 512|
|00000ad0| 29 2c 20 73 6f 20 6b 65 | 65 70 0d 79 6f 75 72 20 |), so ke|ep.your |
|00000ae0| 6c 69 6e 65 73 20 6f 66 | 20 74 65 78 74 20 73 68 |lines of| text sh|
|00000af0| 6f 72 74 65 72 20 74 68 | 61 6e 20 74 68 69 73 20 |orter th|an this |
|00000b00| 74 6f 20 61 76 6f 69 64 | 20 62 72 65 61 6b 69 6e |to avoid| breakin|
|00000b10| 67 20 74 6f 6b 65 6e 73 | 20 61 74 20 74 68 65 20 |g tokens| at the |
|00000b20| 65 6e 64 20 6f 66 20 74 | 68 65 0d 62 75 66 66 65 |end of t|he.buffe|
|00000b30| 72 2e 0d 0d 48 65 72 65 | 20 69 73 20 61 20 73 61 |r...Here| is a sa|
|00000b40| 6d 70 6c 65 20 70 72 6f | 67 72 61 6d 20 74 6f 20 |mple pro|gram to |
|00000b50| 72 65 61 64 20 74 68 65 | 20 61 73 73 69 67 6e 6d |read the| assignm|
|00000b60| 65 6e 74 73 20 67 69 76 | 65 6e 20 61 62 6f 76 65 |ents giv|en above|
|00000b70| 3a 0d 23 69 6e 63 6c 75 | 64 65 20 22 56 69 64 65 |:.#inclu|de "Vide|
|00000b80| 6f 54 6f 6f 6c 62 6f 78 | 2e 68 22 0d 76 6f 69 64 |oToolbox|.h".void|
|00000b90| 20 6d 61 69 6e 28 76 6f | 69 64 29 0d 7b 0d 09 64 | main(vo|id).{..d|
|00000ba0| 6f 75 62 6c 65 20 70 75 | 70 69 6c 4d 6d 2c 6c 6f |ouble pu|pilMm,lo|
|00000bb0| 67 43 2c 76 69 65 77 69 | 6e 67 44 69 73 74 61 6e |gC,viewi|ngDistan|
|00000bc0| 63 65 2c 72 65 73 75 6c | 74 3b 0d 09 73 68 6f 72 |ce,resul|t;..shor|
|00000bd0| 74 20 69 6e 74 20 74 72 | 69 61 6c 73 2c 69 3b 0d |t int tr|ials,i;.|
|00000be0| 09 63 68 61 72 20 2a 6b | 69 6e 64 4f 66 54 72 69 |.char *k|indOfTri|
|00000bf0| 61 6c 2c 2a 6d 65 73 73 | 61 67 65 3b 0d 09 56 61 |al,*mess|age;..Va|
|00000c00| 72 69 61 62 6c 65 20 76 | 5b 38 5d 3b 0d 09 46 49 |riable v|[8];..FI|
|00000c10| 4c 45 20 2a 66 69 6c 65 | 3b 0d 09 0d 09 69 3d 30 |LE *file|;....i=0|
|00000c20| 3b 0d 09 76 5b 69 2b 2b | 5d 3d 53 65 74 56 61 72 |;..v[i++|]=SetVar|
|00000c30| 69 61 62 6c 65 28 73 74 | 72 69 6e 67 54 79 70 65 |iable(st|ringType|
|00000c40| 2c 26 6b 69 6e 64 4f 66 | 54 72 69 61 6c 2c 22 6b |,&kindOf|Trial,"k|
|00000c50| 69 6e 64 4f 66 54 72 69 | 61 6c 22 29 3b 0d 09 76 |indOfTri|al");..v|
|00000c60| 5b 69 2b 2b 5d 3d 53 65 | 74 56 61 72 69 61 62 6c |[i++]=Se|tVariabl|
|00000c70| 65 28 73 74 72 69 6e 67 | 54 79 70 65 2c 26 6d 65 |e(string|Type,&me|
|00000c80| 73 73 61 67 65 2c 22 6d | 65 73 73 61 67 65 22 29 |ssage,"m|essage")|
|00000c90| 3b 0d 09 76 5b 69 2b 2b | 5d 3d 53 65 74 56 61 72 |;..v[i++|]=SetVar|
|00000ca0| 69 61 62 6c 65 28 64 6f | 75 62 6c 65 54 79 70 65 |iable(do|ubleType|
|00000cb0| 2c 26 70 75 70 69 6c 4d | 6d 2c 22 70 75 70 69 6c |,&pupilM|m,"pupil|
|00000cc0| 4d 6d 22 29 3b 0d 09 76 | 5b 69 2b 2b 5d 3d 53 65 |Mm");..v|[i++]=Se|
|00000cd0| 74 56 61 72 69 61 62 6c | 65 28 64 6f 75 62 6c 65 |tVariabl|e(double|
|00000ce0| 54 79 70 65 2c 26 6c 6f | 67 43 2c 22 6c 6f 67 43 |Type,&lo|gC,"logC|
|00000cf0| 22 29 3b 0d 09 76 5b 69 | 2b 2b 5d 3d 53 65 74 56 |");..v[i|++]=SetV|
|00000d00| 61 72 69 61 62 6c 65 28 | 64 6f 75 62 6c 65 54 79 |ariable(|doubleTy|
|00000d10| 70 65 2c 26 76 69 65 77 | 69 6e 67 44 69 73 74 61 |pe,&view|ingDista|
|00000d20| 6e 63 65 2c 22 76 69 65 | 77 69 6e 67 44 69 73 74 |nce,"vie|wingDist|
|00000d30| 61 6e 63 65 22 29 3b 0d | 09 76 5b 69 2b 2b 5d 3d |ance");.|.v[i++]=|
|00000d40| 53 65 74 56 61 72 69 61 | 62 6c 65 28 64 6f 75 62 |SetVaria|ble(doub|
|00000d50| 6c 65 54 79 70 65 2c 26 | 72 65 73 75 6c 74 2c 22 |leType,&|result,"|
|00000d60| 72 65 73 75 6c 74 22 29 | 3b 0d 09 76 5b 69 2b 2b |result")|;..v[i++|
|00000d70| 5d 3d 53 65 74 56 61 72 | 69 61 62 6c 65 28 73 68 |]=SetVar|iable(sh|
|00000d80| 6f 72 74 54 79 70 65 2c | 26 74 72 69 61 6c 73 2c |ortType,|&trials,|
|00000d90| 22 74 72 69 61 6c 73 22 | 29 3b 0d 09 76 5b 69 2b |"trials"|);..v[i+|
|00000da0| 2b 5d 3d 53 65 74 56 61 | 72 69 61 62 6c 65 28 30 |+]=SetVa|riable(0|
|00000db0| 2c 4e 55 4c 4c 2c 4e 55 | 4c 4c 29 3b 09 09 2f 2f |,NULL,NU|LL);..//|
|00000dc0| 20 6d 61 72 6b 20 65 6e | 64 20 6f 66 20 61 72 72 | mark en|d of arr|
|00000dd0| 61 79 0d 09 52 65 61 64 | 41 73 73 69 67 6e 6d 65 |ay..Read|Assignme|
|00000de0| 6e 74 46 69 6c 65 28 22 | 6d 79 46 69 6c 65 22 2c |ntFile("|myFile",|
|00000df0| 76 2c 30 29 3b 09 09 2f | 2f 20 6d 61 6b 65 20 73 |v,0);../|/ make s|
|00000e00| 75 72 65 20 66 69 6c 65 | 20 69 73 20 6f 6b 21 0d |ure file| is ok!.|
|00000e10| 09 66 69 6c 65 3d 66 6f | 70 65 6e 28 22 6d 79 46 |.file=fo|pen("myF|
|00000e20| 69 6c 65 22 2c 22 72 22 | 29 3b 0d 09 49 6e 69 74 |ile","r"|);..Init|
|00000e30| 69 61 6c 69 7a 65 56 61 | 72 69 61 62 6c 65 73 28 |ializeVa|riables(|
|00000e40| 76 29 3b 0d 09 64 6f 7b | 0d 09 09 70 72 69 6e 74 |v);..do{|...print|
|00000e50| 66 28 22 2a 2a 2a 2a 2a | 2a 2a 2a 4e 65 77 20 62 |f("*****|***New b|
|00000e60| 6c 6f 63 6b 2a 2a 2a 2a | 2a 2a 2a 2a 5c 6e 22 29 |lock****|****\n")|
|00000e70| 3b 0d 09 09 52 65 61 64 | 41 73 73 69 67 6e 6d 65 |;...Read|Assignme|
|00000e80| 6e 74 42 6c 6f 63 6b 28 | 66 69 6c 65 2c 76 2c 65 |ntBlock(|file,v,e|
|00000e90| 63 68 6f 41 73 73 69 67 | 6e 6d 65 6e 74 73 29 3b |choAssig|nments);|
|00000ea0| 0d 09 09 2f 2f 20 61 20 | 72 65 61 6c 20 70 72 6f |...// a |real pro|
|00000eb0| 67 72 61 6d 20 77 6f 75 | 6c 64 20 64 6f 20 73 6f |gram wou|ld do so|
|00000ec0| 6d 65 74 68 69 6e 67 20 | 75 73 65 66 75 6c 20 68 |mething |useful h|
|00000ed0| 65 72 65 0d 09 7d 20 77 | 68 69 6c 65 28 21 66 65 |ere..} w|hile(!fe|
|00000ee0| 6f 66 28 66 69 6c 65 29 | 29 3b 0d 09 66 63 6c 6f |of(file)|);..fclo|
|00000ef0| 73 65 28 66 69 6c 65 29 | 3b 0d 7d 0d 0d 48 65 72 |se(file)|;.}..Her|
|00000f00| 65 20 61 72 65 20 74 68 | 65 20 72 6f 75 74 69 6e |e are th|e routin|
|00000f10| 65 73 3a 0d 0d 09 76 5b | 69 2b 2b 5d 3d 53 65 74 |es:...v[|i++]=Set|
|00000f20| 56 61 72 69 61 62 6c 65 | 28 64 6f 75 62 6c 65 54 |Variable|(doubleT|
|00000f30| 79 70 65 2c 26 78 2c 22 | 78 22 29 3b 0d 09 76 5b |ype,&x,"|x");..v[|
|00000f40| 69 2b 2b 5d 3d 53 65 74 | 56 61 72 69 61 62 6c 65 |i++]=Set|Variable|
|00000f50| 28 30 2c 4e 55 4c 4c 2c | 4e 55 4c 4c 29 3b 09 09 |(0,NULL,|NULL);..|
|00000f60| 2f 2a 20 6d 61 72 6b 20 | 65 6e 64 20 6f 66 20 61 |/* mark |end of a|
|00000f70| 72 72 61 79 20 2a 2f 0d | 53 65 74 56 61 72 69 61 |rray */.|SetVaria|
|00000f80| 62 6c 65 20 6d 65 72 65 | 6c 79 20 72 65 74 75 72 |ble mere|ly retur|
|00000f90| 6e 73 20 61 20 56 61 72 | 69 61 62 6c 65 20 77 69 |ns a Var|iable wi|
|00000fa0| 74 68 20 74 68 65 20 66 | 69 65 6c 64 20 76 61 6c |th the f|ield val|
|00000fb0| 75 65 73 20 74 68 61 74 | 20 79 6f 75 20 73 75 70 |ues that| you sup|
|00000fc0| 70 6c 79 2e 20 55 73 65 | 0d 69 74 20 74 6f 20 6d |ply. Use|.it to m|
|00000fd0| 61 6b 65 20 79 6f 75 72 | 20 70 72 6f 67 72 61 6d |ake your| program|
|00000fe0| 73 20 6d 6f 72 65 20 72 | 65 61 64 61 62 6c 65 2e |s more r|eadable.|
|00000ff0| 20 46 6f 72 20 65 78 61 | 6d 70 6c 65 2c 0d 09 76 | For exa|mple,..v|
|00001000| 5b 69 2b 2b 5d 3d 53 65 | 74 56 61 72 69 61 62 6c |[i++]=Se|tVariabl|
|00001010| 65 28 64 6f 75 62 6c 65 | 54 79 70 65 2c 26 78 2c |e(double|Type,&x,|
|00001020| 22 78 22 29 3b 0d 69 73 | 20 65 71 75 69 76 61 6c |"x");.is| equival|
|00001030| 65 6e 74 20 74 6f 0d 09 | 76 5b 69 5d 2e 74 79 70 |ent to..|v[i].typ|
|00001040| 65 3d 64 6f 75 62 6c 65 | 54 79 70 65 3b 0d 09 76 |e=double|Type;..v|
|00001050| 5b 69 5d 2e 70 74 72 3d | 26 78 3b 0d 09 76 5b 69 |[i].ptr=|&x;..v[i|
|00001060| 2b 2b 5d 2e 6e 61 6d 65 | 3d 22 78 22 3b 0d 54 68 |++].name|="x";.Th|
|00001070| 65 20 61 76 61 69 6c 61 | 62 6c 65 20 74 79 70 65 |e availa|ble type|
|00001080| 73 20 61 72 65 3a 20 63 | 68 61 72 54 79 70 65 2c |s are: c|harType,|
|00001090| 20 73 68 6f 72 74 54 79 | 70 65 2c 20 6c 6f 6e 67 | shortTy|pe, long|
|000010a0| 54 79 70 65 2c 20 75 6e | 73 69 67 6e 65 64 43 68 |Type, un|signedCh|
|000010b0| 61 72 54 79 70 65 2c 0d | 75 6e 73 69 67 6e 65 64 |arType,.|unsigned|
|000010c0| 53 68 6f 72 74 54 79 70 | 65 2c 20 75 6e 73 69 67 |ShortTyp|e, unsig|
|000010d0| 6e 65 64 4c 6f 6e 67 54 | 79 70 65 2c 20 64 6f 75 |nedLongT|ype, dou|
|000010e0| 62 6c 65 54 79 70 65 2c | 20 61 6e 64 20 73 74 72 |bleType,| and str|
|000010f0| 69 6e 67 54 79 70 65 2e | 20 28 54 68 65 79 20 61 |ingType.| (They a|
|00001100| 72 65 0d 64 65 66 69 6e | 65 64 20 62 79 20 61 6e |re.defin|ed by an|
|00001110| 20 65 6e 75 6d 20 73 74 | 61 74 65 6d 65 6e 74 20 | enum st|atement |
|00001120| 69 6e 20 74 68 65 20 56 | 69 64 65 6f 54 6f 6f 6c |in the V|ideoTool|
|00001130| 62 6f 78 2e 68 20 68 65 | 61 64 65 72 20 66 69 6c |box.h he|ader fil|
|00001140| 65 2c 20 77 68 69 63 68 | 20 79 6f 75 27 6c 6c 0d |e, which| you'll.|
|00001150| 23 69 6e 63 6c 75 64 65 | 20 69 6e 20 79 6f 75 72 |#include| in your|
|00001160| 20 73 6f 75 72 63 65 20 | 66 69 6c 65 2e 29 20 4e | source |file.) N|
|00001170| 6f 74 65 20 74 68 61 74 | 20 77 68 65 6e 20 79 6f |ote that| when yo|
|00001180| 75 20 69 6e 64 69 63 61 | 74 65 20 73 74 72 69 6e |u indica|te strin|
|00001190| 67 54 79 70 65 2c 20 79 | 6f 75 0d 73 68 6f 75 6c |gType, y|ou.shoul|
|000011a0| 64 20 73 75 70 70 6c 79 | 20 74 68 65 20 61 64 64 |d supply| the add|
|000011b0| 72 65 73 73 20 6f 66 20 | 61 20 63 68 61 72 20 70 |ress of |a char p|
|000011c0| 6f 69 6e 74 65 72 20 76 | 61 72 69 61 62 6c 65 2e |ointer v|ariable.|
|000011d0| 20 4c 61 74 65 72 2c 20 | 63 61 6c 6c 69 6e 67 0d | Later, |calling.|
|000011e0| 49 6e 69 74 69 61 6c 69 | 7a 65 56 61 72 69 61 62 |Initiali|zeVariab|
|000011f0| 6c 65 73 28 29 20 77 69 | 6c 6c 20 69 6e 69 74 69 |les() wi|ll initi|
|00001200| 61 6c 69 7a 65 20 79 6f | 75 72 20 76 61 72 69 61 |alize yo|ur varia|
|00001210| 62 6c 65 20 74 6f 20 70 | 6f 69 6e 74 20 74 6f 20 |ble to p|oint to |
|00001220| 61 20 6e 75 6c 6c 20 73 | 74 72 69 6e 67 2c 0d 22 |a null s|tring,."|
|00001230| 22 2c 20 61 6e 64 20 63 | 61 6c 6c 69 6e 67 20 52 |", and c|alling R|
|00001240| 65 61 64 41 73 73 69 67 | 6e 6d 65 6e 74 4c 69 6e |eadAssig|nmentLin|
|00001250| 65 2c 20 69 66 20 69 74 | 20 66 69 6e 64 73 20 61 |e, if it| finds a|
|00001260| 20 6d 61 74 63 68 2c 20 | 77 69 6c 6c 20 61 6c 6c | match, |will all|
|00001270| 6f 63 61 74 65 20 73 74 | 6f 72 61 67 65 0d 62 79 |ocate st|orage.by|
|00001280| 20 63 61 6c 6c 69 6e 67 | 20 6d 61 6c 6c 6f 63 28 | calling| malloc(|
|00001290| 29 20 61 6e 64 20 70 6c | 61 63 65 20 74 68 65 20 |) and pl|ace the |
|000012a0| 61 64 64 72 65 73 73 20 | 6f 66 20 74 68 65 20 73 |address |of the s|
|000012b0| 74 72 69 6e 67 20 69 6e | 20 79 6f 75 72 20 76 61 |tring in| your va|
|000012c0| 72 69 61 62 6c 65 2e 0d | 0d 09 6e 3d 49 6e 69 74 |riable..|..n=Init|
|000012d0| 69 61 6c 69 7a 65 56 61 | 72 69 61 62 6c 65 73 28 |ializeVa|riables(|
|000012e0| 76 61 72 69 61 62 6c 65 | 29 3b 0d 09 49 6e 69 74 |variable|);..Init|
|000012f0| 69 61 6c 69 7a 65 41 56 | 61 72 69 61 62 6c 65 28 |ializeAV|ariable(|
|00001300| 76 61 72 69 61 62 6c 65 | 29 3b 0d 54 68 65 73 65 |variable|);.These|
|00001310| 20 75 74 69 6c 69 74 69 | 65 73 20 75 73 65 20 79 | utiliti|es use y|
|00001320| 6f 75 72 20 56 61 72 69 | 61 62 6c 65 20 61 72 72 |our Vari|able arr|
|00001330| 61 79 20 6f 72 20 61 20 | 73 69 6e 67 6c 65 20 56 |ay or a |single V|
|00001340| 61 72 69 61 62 6c 65 20 | 74 6f 20 69 6e 69 74 69 |ariable |to initi|
|00001350| 61 6c 69 7a 65 2e 20 41 | 6c 6c 0d 63 68 61 72 2c |alize. A|ll.char,|
|00001360| 20 73 68 6f 72 74 2c 20 | 61 6e 64 20 6c 6f 6e 67 | short, |and long|
|00001370| 20 76 61 72 69 61 62 6c | 65 73 20 61 72 65 20 73 | variabl|es are s|
|00001380| 65 74 20 74 6f 20 7a 65 | 72 6f 2c 20 61 6c 6c 20 |et to ze|ro, all |
|00001390| 64 6f 75 62 6c 65 20 76 | 61 72 69 61 62 6c 65 73 |double v|ariables|
|000013a0| 20 61 72 65 20 73 65 74 | 20 74 6f 0d 4e 41 4e 2c | are set| to.NAN,|
|000013b0| 20 61 6e 64 20 61 6c 6c | 20 74 68 65 20 73 74 72 | and all| the str|
|000013c0| 69 6e 67 73 20 61 72 65 | 20 73 65 74 20 74 6f 20 |ings are| set to |
|000013d0| 22 22 2e 20 28 41 6c 6c | 20 74 68 65 20 73 74 72 |"". (All| the str|
|000013e0| 69 6e 67 20 70 6f 69 6e | 74 65 72 73 20 61 72 65 |ing poin|ters are|
|000013f0| 20 69 6e 69 74 69 61 6c | 69 7a 65 64 0d 74 6f 20 | initial|ized.to |
|00001400| 70 6f 69 6e 74 20 74 6f | 20 74 68 65 20 73 61 6d |point to| the sam|
|00001410| 65 20 65 6d 70 74 79 20 | 73 74 72 69 6e 67 2e 29 |e empty |string.)|
|00001420| 0d 0d 09 6e 3d 52 65 61 | 64 41 73 73 69 67 6e 6d |...n=Rea|dAssignm|
|00001430| 65 6e 74 4c 69 6e 65 28 | 66 69 6c 65 2c 76 61 72 |entLine(|file,var|
|00001440| 69 61 62 6c 65 73 2c 65 | 63 68 6f 29 3b 0d 49 6e |iables,e|cho);.In|
|00001450| 74 65 72 70 72 65 74 73 | 20 6f 6e 65 20 6c 69 6e |terprets| one lin|
|00001460| 65 20 66 72 6f 6d 20 74 | 68 65 20 66 69 6c 65 2c |e from t|he file,|
|00001470| 20 61 6e 64 20 63 6f 6e | 74 69 6e 75 65 73 20 74 | and con|tinues t|
|00001480| 6f 20 72 65 61 64 20 66 | 75 72 74 68 65 72 20 6c |o read f|urther l|
|00001490| 69 6e 65 73 2c 20 69 66 | 0d 6e 65 63 65 73 73 61 |ines, if|.necessa|
|000014a0| 72 79 2c 20 74 6f 20 72 | 65 61 63 68 20 74 68 65 |ry, to r|each the|
|000014b0| 20 65 6e 64 20 6f 66 20 | 61 6e 79 20 69 6e 63 6f | end of |any inco|
|000014c0| 6d 70 6c 65 74 65 20 63 | 6f 6d 6d 65 6e 74 20 6f |mplete c|omment o|
|000014d0| 72 20 61 73 73 69 67 6e | 6d 65 6e 74 2e 0d 52 65 |r assign|ment..Re|
|000014e0| 61 64 41 73 73 69 67 6e | 6d 65 6e 74 42 6c 6f 63 |adAssign|mentBloc|
|000014f0| 6b 28 29 20 61 6e 64 20 | 52 65 61 64 41 73 73 69 |k() and |ReadAssi|
|00001500| 67 6e 6d 65 6e 74 46 69 | 6c 65 28 29 20 64 6f 20 |gnmentFi|le() do |
|00001510| 61 6c 6c 20 74 68 65 69 | 72 20 72 65 61 64 69 6e |all thei|r readin|
|00001520| 67 20 62 79 0d 72 65 70 | 65 61 74 65 64 6c 79 20 |g by.rep|eatedly |
|00001530| 63 61 6c 6c 69 6e 67 20 | 52 65 61 64 41 73 73 69 |calling |ReadAssi|
|00001540| 67 6e 6d 65 6e 74 4c 69 | 6e 65 28 29 2e 0d 0d 09 |gnmentLi|ne()....|
|00001550| 62 6c 61 6e 6b 3d 41 73 | 73 69 67 6e 6d 65 6e 74 |blank=As|signment|
|00001560| 4c 69 6e 65 57 61 73 42 | 6c 61 6e 6b 28 29 3b 0d |LineWasB|lank();.|
|00001570| 52 65 74 75 72 6e 73 20 | 74 72 75 65 20 28 69 2e |Returns |true (i.|
|00001580| 65 2e 20 31 29 20 75 6e | 6c 65 73 73 20 74 68 65 |e. 1) un|less the|
|00001590| 20 6d 6f 73 74 20 72 65 | 63 65 6e 74 20 63 61 6c | most re|cent cal|
|000015a0| 6c 20 74 6f 20 52 65 61 | 64 41 73 73 69 67 6e 6d |l to Rea|dAssignm|
|000015b0| 65 6e 74 4c 69 6e 65 28 | 29 20 72 65 61 64 20 73 |entLine(|) read s|
|000015c0| 6f 6d 65 0d 6e 6f 6e 2d | 62 6c 61 6e 6b 20 74 65 |ome.non-|blank te|
|000015d0| 78 74 2e 20 0d 0d 09 6e | 3d 52 65 61 64 41 73 73 |xt. ...n|=ReadAss|
|000015e0| 69 67 6e 6d 65 6e 74 42 | 6c 6f 63 6b 28 66 69 6c |ignmentB|lock(fil|
|000015f0| 65 2c 76 61 72 69 61 62 | 6c 65 73 2c 65 63 68 6f |e,variab|les,echo|
|00001600| 29 3b 0d 49 6e 74 65 72 | 70 72 65 74 73 20 6c 69 |);.Inter|prets li|
|00001610| 6e 65 73 20 66 72 6f 6d | 20 74 68 65 20 66 69 6c |nes from| the fil|
|00001620| 65 20 75 6e 74 69 6c 20 | 69 74 20 72 65 61 64 73 |e until |it reads|
|00001630| 20 61 6e 20 69 73 6f 6c | 61 74 65 64 20 62 6c 61 | an isol|ated bla|
|00001640| 6e 6b 20 6c 69 6e 65 2e | 20 28 42 6c 61 6e 6b 0d |nk line.| (Blank.|
|00001650| 6c 69 6e 65 73 20 77 69 | 74 68 69 6e 20 61 6e 20 |lines wi|thin an |
|00001660| 61 73 73 69 67 6e 6d 65 | 6e 74 20 6f 72 20 63 6f |assignme|nt or co|
|00001670| 6d 6d 65 6e 74 20 2f 2a | 20 2a 2f 20 61 72 65 20 |mment /*| */ are |
|00001680| 69 67 6e 6f 72 65 64 2e | 29 20 53 6f 20 73 65 70 |ignored.|) So sep|
|00001690| 61 72 61 74 65 20 79 6f | 75 72 0d 62 6c 6f 63 6b |arate yo|ur.block|
|000016a0| 73 20 62 79 20 61 20 62 | 6c 61 6e 6b 20 6c 69 6e |s by a b|lank lin|
|000016b0| 65 2e 20 41 20 62 6c 61 | 6e 6b 20 6c 69 6e 65 20 |e. A bla|nk line |
|000016c0| 6d 61 79 20 63 6f 6e 74 | 61 69 6e 20 73 70 61 63 |may cont|ain spac|
|000016d0| 65 73 2c 20 74 61 62 73 | 2c 20 72 65 74 75 72 6e |es, tabs|, return|
|000016e0| 73 2c 0d 6e 65 77 6c 69 | 6e 65 73 2c 20 66 6f 72 |s,.newli|nes, for|
|000016f0| 6d 66 65 65 64 73 2c 20 | 61 6e 64 20 76 65 72 74 |mfeeds, |and vert|
|00001700| 69 63 61 6c 20 74 61 62 | 73 2e 20 49 6d 70 6c 65 |ical tab|s. Imple|
|00001710| 6d 65 6e 74 65 64 20 62 | 79 20 72 65 70 65 61 74 |mented b|y repeat|
|00001720| 65 64 6c 79 20 63 61 6c | 6c 69 6e 67 0d 52 65 61 |edly cal|ling.Rea|
|00001730| 64 41 73 73 69 67 6e 6d | 65 6e 74 4c 69 6e 65 28 |dAssignm|entLine(|
|00001740| 29 20 75 6e 74 69 6c 20 | 41 73 73 69 67 6e 6d 65 |) until |Assignme|
|00001750| 6e 74 4c 69 6e 65 57 61 | 73 42 6c 61 6e 6b 28 29 |ntLineWa|sBlank()|
|00001760| 20 69 73 20 74 72 75 65 | 2e 0d 0d 09 6e 3d 52 65 | is true|....n=Re|
|00001770| 61 64 41 73 73 69 67 6e | 6d 65 6e 74 46 69 6c 65 |adAssign|mentFile|
|00001780| 28 66 69 6c 65 6e 61 6d | 65 2c 76 61 72 69 61 62 |(filenam|e,variab|
|00001790| 6c 65 73 2c 65 63 68 6f | 29 3b 0d 55 73 65 20 74 |les,echo|);.Use t|
|000017a0| 68 69 73 20 74 6f 20 69 | 6e 74 65 72 70 72 65 74 |his to i|nterpret|
|000017b0| 20 61 20 77 68 6f 6c 65 | 20 66 69 6c 65 20 61 74 | a whole| file at|
|000017c0| 20 6f 6e 63 65 2e 20 49 | 74 20 65 76 65 6e 20 6f | once. I|t even o|
|000017d0| 70 65 6e 73 20 61 6e 64 | 20 63 6c 6f 73 65 73 20 |pens and| closes |
|000017e0| 74 68 65 20 66 69 6c 65 | 20 66 6f 72 20 0d 79 6f |the file| for .yo|
|000017f0| 75 2e 20 49 6d 70 6c 65 | 6d 65 6e 74 65 64 20 62 |u. Imple|mented b|
|00001800| 79 20 72 65 70 65 61 74 | 65 64 6c 79 20 63 61 6c |y repeat|edly cal|
|00001810| 6c 69 6e 67 20 52 65 61 | 64 41 73 73 69 67 6e 6d |ling Rea|dAssignm|
|00001820| 65 6e 74 4c 69 6e 65 28 | 29 2e 0d 0d 09 50 72 69 |entLine(|)....Pri|
|00001830| 6e 74 41 73 73 69 67 6e | 6d 65 6e 74 28 66 69 6c |ntAssign|ment(fil|
|00001840| 65 2c 26 76 61 72 69 61 | 62 6c 65 29 3b 0d 50 72 |e,&varia|ble);.Pr|
|00001850| 69 6e 74 73 20 6f 75 74 | 20 74 68 65 20 6e 61 6d |ints out| the nam|
|00001860| 65 20 61 6e 64 20 76 61 | 6c 75 65 20 6f 66 20 74 |e and va|lue of t|
|00001870| 68 65 20 76 61 72 69 61 | 62 6c 65 2c 20 61 73 20 |he varia|ble, as |
|00001880| 61 6e 20 61 73 73 69 67 | 6e 6d 65 6e 74 20 73 74 |an assig|nment st|
|00001890| 61 74 65 6d 65 6e 74 2c | 20 73 75 69 74 61 62 6c |atement,| suitabl|
|000018a0| 65 0d 66 6f 72 20 72 65 | 61 64 69 6e 67 20 62 79 |e.for re|ading by|
|000018b0| 20 61 6e 79 20 6f 66 20 | 74 68 65 20 52 65 61 64 | any of |the Read|
|000018c0| 41 73 73 69 67 6e 6d 65 | 6e 74 20 72 6f 75 74 69 |Assignme|nt routi|
|000018d0| 6e 65 73 2e 0d 0d 09 6e | 3d 52 65 61 64 4c 75 6d |nes....n|=ReadLum|
|000018e0| 69 6e 61 6e 63 65 52 65 | 63 6f 72 64 28 66 69 6c |inanceRe|cord(fil|
|000018f0| 65 6e 61 6d 65 2c 4c 50 | 2c 65 63 68 6f 29 0d 54 |ename,LP|,echo).T|
|00001900| 68 69 73 20 75 73 65 73 | 20 52 65 61 64 41 73 73 |his uses| ReadAss|
|00001910| 69 67 6e 6d 65 6e 74 46 | 69 6c 65 28 29 20 74 6f |ignmentF|ile() to|
|00001920| 20 69 6e 74 65 72 70 72 | 65 74 20 61 20 4c 75 6d | interpr|et a Lum|
|00001930| 69 6e 61 6e 63 65 52 65 | 63 6f 72 64 3f 2e 68 20 |inanceRe|cord?.h |
|00001940| 66 69 6c 65 2e 20 54 68 | 69 73 0d 72 6f 75 74 69 |file. Th|is.routi|
|00001950| 6e 65 20 69 73 20 69 6e | 20 52 65 61 64 4c 75 6d |ne is in| ReadLum|
|00001960| 69 6e 61 6e 63 65 52 65 | 63 6f 72 64 2e 63 2e 0d |inanceRe|cord.c..|
|00001970| 0d 54 68 65 20 72 65 74 | 75 72 6e 65 64 20 76 61 |.The ret|urned va|
|00001980| 6c 75 65 2c 20 6e 2c 20 | 69 73 20 74 68 65 20 6e |lue, n, |is the n|
|00001990| 75 6d 62 65 72 20 6f 66 | 20 61 73 73 69 67 6e 6d |umber of| assignm|
|000019a0| 65 6e 74 73 20 74 68 61 | 74 20 77 65 72 65 20 69 |ents tha|t were i|
|000019b0| 6e 74 65 72 70 72 65 74 | 65 64 2e 0d 0d 54 68 65 |nterpret|ed...The|
|000019c0| 20 73 65 63 6f 6e 64 20 | 61 72 67 75 6d 65 6e 74 | second |argument|
|000019d0| 2c 20 22 76 61 72 69 61 | 62 6c 65 73 22 2c 20 69 |, "varia|bles", i|
|000019e0| 73 20 61 6e 20 61 72 72 | 61 79 20 6f 66 20 22 56 |s an arr|ay of "V|
|000019f0| 61 72 69 61 62 6c 65 22 | 20 73 74 72 75 63 74 73 |ariable"| structs|
|00001a00| 20 64 65 73 63 72 69 62 | 69 6e 67 0d 74 68 65 20 | describ|ing.the |
|00001a10| 6e 61 6d 65 73 2c 20 61 | 64 64 72 65 73 73 65 73 |names, a|ddresses|
|00001a20| 2c 20 61 6e 64 20 74 79 | 70 65 73 20 6f 66 20 79 |, and ty|pes of y|
|00001a30| 6f 75 72 20 76 61 72 69 | 61 62 6c 65 73 2e 20 54 |our vari|ables. T|
|00001a40| 68 65 20 6e 75 6d 62 65 | 72 20 6f 66 20 61 72 72 |he numbe|r of arr|
|00001a50| 61 79 20 65 6c 65 6d 65 | 6e 74 73 0d 69 73 20 6e |ay eleme|nts.is n|
|00001a60| 6f 74 20 67 69 76 65 6e | 2e 20 49 6e 73 74 65 61 |ot given|. Instea|
|00001a70| 64 20 79 6f 75 20 6d 61 | 72 6b 20 74 68 65 20 65 |d you ma|rk the e|
|00001a80| 6e 64 20 62 79 20 61 6e | 20 65 6c 65 6d 65 6e 74 |nd by an| element|
|00001a90| 20 77 69 74 68 20 74 68 | 65 20 22 74 79 70 65 22 | with th|e "type"|
|00001aa0| 20 66 69 65 6c 64 20 73 | 65 74 0d 74 6f 20 7a 65 | field s|et.to ze|
|00001ab0| 72 6f 2e 20 54 68 65 20 | 22 56 61 72 69 61 62 6c |ro. The |"Variabl|
|00001ac0| 65 22 20 64 61 74 61 20 | 73 74 72 75 63 74 75 72 |e" data |structur|
|00001ad0| 65 20 69 73 20 64 65 66 | 69 6e 65 64 20 69 6e 20 |e is def|ined in |
|00001ae0| 56 69 64 65 6f 54 6f 6f | 6c 62 6f 78 2e 68 2e 0d |VideoToo|lbox.h..|
|00001af0| 0d 54 68 65 20 74 68 69 | 72 64 20 61 72 67 75 6d |.The thi|rd argum|
|00001b00| 65 6e 74 2c 20 22 65 63 | 68 6f 22 2c 20 77 61 73 |ent, "ec|ho", was|
|00001b10| 20 64 65 76 65 6c 6f 70 | 65 64 20 66 6f 72 20 64 | develop|ed for d|
|00001b20| 65 62 75 67 67 69 6e 67 | 20 62 75 74 20 69 74 20 |ebugging| but it |
|00001b30| 69 73 20 73 6f 20 68 61 | 6e 64 79 20 74 68 61 74 |is so ha|ndy that|
|00001b40| 20 69 74 0d 73 74 61 79 | 65 64 20 69 6e 20 74 68 | it.stay|ed in th|
|00001b50| 65 20 66 69 6e 61 6c 20 | 76 65 72 73 69 6f 6e 2e |e final |version.|
|00001b60| 20 49 74 20 61 6c 6c 6f | 77 73 20 79 6f 75 20 74 | It allo|ws you t|
|00001b70| 6f 20 72 65 71 75 65 73 | 74 20 74 68 61 74 20 74 |o reques|t that t|
|00001b80| 68 65 20 61 73 73 69 67 | 6e 6d 65 6e 74 20 61 6e |he assig|nment an|
|00001b90| 64 2f 6f 72 0d 74 68 65 | 20 63 6f 6d 6d 65 6e 74 |d/or.the| comment|
|00001ba0| 73 20 61 6e 64 2f 6f 72 | 20 74 68 65 20 6f 72 69 |s and/or| the ori|
|00001bb0| 67 69 6e 61 6c 20 66 69 | 6c 65 20 62 65 20 6c 69 |ginal fi|le be li|
|00001bc0| 73 74 65 64 20 6f 6e 20 | 74 68 65 20 63 6f 6e 73 |sted on |the cons|
|00001bd0| 6f 6c 65 20 62 79 20 70 | 72 69 6e 74 66 2e 20 22 |ole by p|rintf. "|
|00001be0| 65 63 68 6f 22 0d 73 68 | 6f 75 6c 64 20 62 65 20 |echo".sh|ould be |
|00001bf0| 61 6e 20 69 6e 74 65 67 | 65 72 20 76 61 6c 75 65 |an integ|er value|
|00001c00| 20 66 6f 72 6d 65 64 20 | 62 79 20 73 75 6d 6d 69 | formed |by summi|
|00001c10| 6e 67 20 73 6f 6d 65 20 | 6f 72 20 61 6c 6c 20 6f |ng some |or all o|
|00001c20| 66 20 70 72 65 64 65 66 | 69 6e 65 64 0d 63 6f 6e |f predef|ined.con|
|00001c30| 73 74 61 6e 74 73 3a 20 | 65 63 68 6f 41 73 73 69 |stants: |echoAssi|
|00001c40| 67 6e 6d 65 6e 74 73 2c | 20 65 63 68 6f 43 6f 6d |gnments,| echoCom|
|00001c50| 6d 65 6e 74 73 2c 20 65 | 63 68 6f 46 69 6c 65 2e |ments, e|choFile.|
|00001c60| 20 0d 0d 65 63 68 6f 46 | 69 6c 65 20 70 72 69 6e | ..echoF|ile prin|
|00001c70| 74 73 20 65 61 63 68 20 | 6c 69 6e 65 20 66 72 6f |ts each |line fro|
|00001c80| 6d 20 74 68 65 20 66 69 | 6c 65 2e 0d 0d 65 63 68 |m the fi|le...ech|
|00001c90| 6f 41 73 73 69 67 6e 6d | 65 6e 74 73 20 72 65 67 |oAssignm|ents reg|
|00001ca0| 65 6e 65 72 61 74 65 73 | 20 74 68 65 20 61 73 73 |enerates| the ass|
|00001cb0| 69 67 6d 65 6e 74 20 73 | 74 61 74 65 6d 65 6e 74 |igment s|tatement|
|00001cc0| 20 62 79 20 70 72 69 6e | 74 69 6e 67 20 74 68 65 | by prin|ting the|
|00001cd0| 20 76 61 72 69 61 62 6c | 65 0d 6e 61 6d 65 2c 20 | variabl|e.name, |
|00001ce0| 61 6e 20 65 71 75 61 6c | 20 73 69 67 6e 2c 20 74 |an equal| sign, t|
|00001cf0| 68 65 20 73 74 6f 72 65 | 64 20 76 61 6c 75 65 2c |he store|d value,|
|00001d00| 20 61 20 73 65 6d 69 63 | 6f 6c 6f 6e 20 61 6e 64 | a semic|olon and|
|00001d10| 20 61 20 73 70 61 63 65 | 2e 20 55 6e 63 6f 6d 6d | a space|. Uncomm|
|00001d20| 65 6e 74 65 64 0d 6e 65 | 77 6c 69 6e 65 20 63 68 |ented.ne|wline ch|
|00001d30| 61 72 61 63 74 65 72 73 | 20 69 6e 20 74 68 65 20 |aracters| in the |
|00001d40| 73 6f 75 72 63 65 20 66 | 69 6c 65 20 61 72 65 20 |source f|ile are |
|00001d50| 65 63 68 6f 65 64 20 61 | 73 20 77 65 6c 6c 2e 0d |echoed a|s well..|
|00001d60| 0d 65 63 68 6f 43 6f 6d | 6d 65 6e 74 73 20 70 72 |.echoCom|ments pr|
|00001d70| 69 6e 74 73 20 62 6f 74 | 68 20 2f 2a 2e 2e 2a 2f |ints bot|h /*..*/|
|00001d80| 20 61 6e 64 20 2f 2f 2d | 73 74 79 6c 65 20 63 6f | and //-|style co|
|00001d90| 6d 6d 65 6e 74 73 2e 20 | 55 6e 63 6f 6d 6d 65 6e |mments. |Uncommen|
|00001da0| 74 65 64 0d 6e 65 77 6c | 69 6e 65 20 63 68 61 72 |ted.newl|ine char|
|00001db0| 61 63 74 65 72 73 20 69 | 6e 20 74 68 65 20 73 6f |acters i|n the so|
|00001dc0| 75 72 63 65 20 66 69 6c | 65 20 61 72 65 20 65 63 |urce fil|e are ec|
|00001dd0| 68 6f 65 64 20 61 73 20 | 77 65 6c 6c 2e 0d 0d 54 |hoed as |well...T|
|00001de0| 68 65 79 20 61 72 65 20 | 64 65 66 69 6e 65 64 20 |hey are |defined |
|00001df0| 62 79 20 61 6e 20 65 6e | 75 6d 20 73 74 61 74 65 |by an en|um state|
|00001e00| 6d 65 6e 74 20 69 6e 20 | 74 68 65 20 56 69 64 65 |ment in |the Vide|
|00001e10| 6f 54 6f 6f 6c 62 6f 78 | 2e 68 20 68 65 61 64 65 |oToolbox|.h heade|
|00001e20| 72 20 66 69 6c 65 2c 20 | 77 68 69 63 68 0d 79 6f |r file, |which.yo|
|00001e30| 75 20 73 68 6f 75 6c 64 | 20 23 69 6e 63 6c 75 64 |u should| #includ|
|00001e40| 65 20 69 6e 20 79 6f 75 | 72 20 73 6f 75 72 63 65 |e in you|r source|
|00001e50| 20 66 69 6c 65 2e 20 53 | 65 74 20 65 63 68 6f 20 | file. S|et echo |
|00001e60| 74 6f 20 7a 65 72 6f 20 | 66 6f 72 20 6e 6f 20 70 |to zero |for no p|
|00001e70| 72 69 6e 74 66 27 73 2e | 0d 54 75 72 6e 69 6e 67 |rintf's.|.Turning|
|00001e80| 20 74 68 65 6d 20 61 6c | 6c 20 6f 6e 20 61 6c 6c | them al|l on all|
|00001e90| 6f 77 73 20 79 6f 75 20 | 74 6f 20 6d 6f 6e 69 74 |ows you |to monit|
|00001ea0| 6f 72 20 74 68 65 20 6f | 70 65 72 61 74 69 6f 6e |or the o|peration|
|00001eb0| 20 6f 66 20 52 65 61 64 | 41 73 73 69 67 6e 6d 65 | of Read|Assignme|
|00001ec0| 6e 74 4c 69 6e 65 2e 0d | 54 75 72 6e 69 6e 67 20 |ntLine..|Turning |
|00001ed0| 6f 6e 20 6a 75 73 74 20 | 63 6f 6d 6d 65 6e 74 73 |on just |comments|
|00001ee0| 2c 20 66 6f 72 20 65 78 | 61 6d 70 6c 65 2c 20 6d |, for ex|ample, m|
|00001ef0| 69 67 68 74 20 62 65 20 | 68 65 6c 70 66 75 6c 20 |ight be |helpful |
|00001f00| 69 6e 20 72 65 6d 69 6e | 64 69 6e 67 20 79 6f 75 |in remin|ding you|
|00001f10| 20 6f 66 0d 77 68 61 74 | 27 73 20 69 6e 20 74 68 | of.what|'s in th|
|00001f20| 65 20 66 69 6c 65 20 62 | 65 69 6e 67 20 69 6e 74 |e file b|eing int|
|00001f30| 65 72 70 72 65 74 65 64 | 2e 0d 0d 49 4d 50 4f 52 |erpreted|...IMPOR|
|00001f40| 54 41 4e 54 3a 20 44 6f | 6e 27 74 20 66 6f 72 67 |TANT: Do|n't forg|
|00001f50| 65 74 20 74 6f 20 6d 61 | 72 6b 20 74 68 65 20 65 |et to ma|rk the e|
|00001f60| 6e 64 20 6f 66 20 79 6f | 75 72 20 76 61 72 69 61 |nd of yo|ur varia|
|00001f70| 62 6c 65 20 61 72 72 61 | 79 20 62 79 20 73 65 74 |ble arra|y by set|
|00001f80| 74 69 6e 67 20 74 68 65 | 0d 6c 61 73 74 20 65 6c |ting the|.last el|
|00001f90| 65 6d 65 6e 74 27 73 20 | 74 79 70 65 20 74 6f 20 |ement's |type to |
|00001fa0| 7a 65 72 6f 2e 0d 0d 52 | 65 61 64 41 73 73 69 67 |zero...R|eadAssig|
|00001fb0| 6e 6d 65 6e 74 73 20 77 | 61 73 20 69 6e 73 70 69 |nments w|as inspi|
|00001fc0| 72 65 64 20 62 79 20 61 | 6e 20 69 64 65 61 20 42 |red by a|n idea B|
|00001fd0| 65 61 75 20 57 61 74 73 | 6f 6e 20 6d 65 6e 74 69 |eau Wats|on menti|
|00001fe0| 6f 6e 65 64 20 74 6f 20 | 6d 65 20 69 6e 20 74 68 |oned to |me in th|
|00001ff0| 65 20 31 39 38 30 27 73 | 3a 20 0d 61 20 72 6f 75 |e 1980's|: .a rou|
|00002000| 74 69 6e 65 20 74 6f 20 | 72 65 61 64 20 66 72 65 |tine to |read fre|
|00002010| 65 2d 66 6f 72 6d 20 70 | 61 72 61 6d 65 74 65 72 |e-form p|arameter|
|00002020| 20 76 61 6c 75 65 73 20 | 61 74 20 72 75 6e 20 74 | values |at run t|
|00002030| 69 6d 65 2e 0d 0d 48 49 | 53 54 4f 52 59 3a 0d 37 |ime...HI|STORY:.7|
|00002040| 2f 33 30 2f 39 31 20 64 | 67 70 09 77 72 6f 74 65 |/30/91 d|gp.wrote|
|00002050| 20 69 74 2e 0d 38 2f 34 | 2f 39 31 09 64 67 70 20 | it..8/4|/91.dgp |
|00002060| 61 64 64 65 64 20 6e 65 | 77 20 72 6f 75 74 69 6e |added ne|w routin|
|00002070| 65 73 20 61 6e 64 20 72 | 65 6e 61 6d 65 64 20 74 |es and r|enamed t|
|00002080| 68 65 20 6f 6c 64 20 6f | 6e 65 73 2e 20 45 76 65 |he old o|nes. Eve|
|00002090| 72 79 74 68 69 6e 67 0d | 09 09 09 73 65 65 6d 73 |rything.|...seems|
|000020a0| 20 74 6f 20 77 6f 72 6b | 2c 20 62 75 74 20 68 61 | to work|, but ha|
|000020b0| 73 20 6e 6f 74 20 62 65 | 65 6e 20 74 68 6f 72 6f |s not be|en thoro|
|000020c0| 75 67 68 6c 79 20 74 65 | 73 74 65 64 2e 0d 38 2f |ughly te|sted..8/|
|000020d0| 35 2f 39 31 09 64 67 70 | 09 4d 50 57 20 43 20 33 |5/91.dgp|.MPW C 3|
|000020e0| 2e 32 20 6e 6f 77 20 63 | 6f 6d 70 69 6c 65 73 20 |.2 now c|ompiles |
|000020f0| 69 74 20 77 69 74 68 6f | 75 74 20 65 72 72 6f 72 |it witho|ut error|
|00002100| 20 6d 65 73 73 61 67 65 | 73 2e 20 54 68 65 20 4d | message|s. The M|
|00002110| 50 57 20 43 20 6d 61 63 | 72 6f 20 70 72 6f 63 65 |PW C mac|ro proce|
|00002120| 73 73 6f 72 2c 0d 09 09 | 09 63 6f 6e 74 72 61 72 |ssor,...|.contrar|
|00002130| 79 20 74 6f 20 41 4e 53 | 49 20 43 2c 20 66 69 6e |y to ANS|I C, fin|
|00002140| 64 73 20 63 6f 6d 6d 65 | 6e 74 20 73 79 6d 62 6f |ds comme|nt symbo|
|00002150| 6c 73 20 69 6e 73 69 64 | 65 20 73 74 72 69 6e 67 |ls insid|e string|
|00002160| 73 20 61 6e 64 20 66 69 | 6e 64 73 20 0d 09 09 09 |s and fi|nds ....|
|00002170| 70 72 65 70 72 6f 63 65 | 73 73 6f 72 20 64 69 72 |preproce|ssor dir|
|00002180| 65 63 74 69 76 65 73 20 | 65 76 65 6e 20 77 68 65 |ectives |even whe|
|00002190| 6e 20 23 20 69 73 20 6e | 6f 74 20 74 68 65 20 66 |n # is n|ot the f|
|000021a0| 69 72 73 74 20 6e 6f 6e | 62 6c 61 6e 6b 20 63 68 |irst non|blank ch|
|000021b0| 61 72 61 63 74 65 72 2e | 0d 38 2f 32 34 2f 39 31 |aracter.|.8/24/91|
|000021c0| 09 64 67 70 09 4d 61 64 | 65 20 63 6f 6d 70 61 74 |.dgp.Mad|e compat|
|000021d0| 69 62 6c 65 20 77 69 74 | 68 20 54 48 49 4e 4b 20 |ible wit|h THINK |
|000021e0| 43 20 35 2e 30 2e 0d 09 | 09 09 43 68 61 6e 67 65 |C 5.0...|..Change|
|000021f0| 64 20 52 65 61 64 41 73 | 73 69 67 6e 6d 65 6e 74 |d ReadAs|signment|
|00002200| 20 66 69 6c 65 20 74 6f | 20 72 65 74 75 72 6e 20 | file to| return |
|00002210| 61 6e 20 65 72 72 6f 72 | 20 63 6f 64 65 20 69 6e |an error| code in|
|00002220| 73 74 65 61 64 20 6f 66 | 20 61 62 6f 72 74 69 6e |stead of| abortin|
|00002230| 67 0d 09 09 09 69 66 20 | 69 74 20 63 61 6e 27 74 |g....if |it can't|
|00002240| 20 6f 70 65 6e 20 74 68 | 65 20 66 69 6c 65 2e 0d | open th|e file..|
|00002250| 38 2f 32 36 2f 39 31 09 | 64 67 70 09 41 64 64 65 |8/26/91.|dgp.Adde|
|00002260| 64 20 53 65 74 56 61 72 | 69 61 62 6c 65 28 29 20 |d SetVar|iable() |
|00002270| 61 6e 64 20 6e 6f 74 65 | 64 2c 20 61 62 6f 76 65 |and note|d, above|
|00002280| 2c 20 74 68 61 74 20 74 | 68 65 20 56 61 72 69 61 |, that t|he Varia|
|00002290| 62 6c 65 20 61 72 72 61 | 79 0d 09 09 09 69 73 20 |ble arra|y....is |
|000022a0| 74 65 72 6d 69 6e 61 74 | 65 64 20 62 79 20 61 6e |terminat|ed by an|
|000022b0| 20 65 6c 65 6d 65 6e 74 | 20 77 69 74 68 20 69 74 | element| with it|
|000022c0| 73 20 22 74 79 70 65 22 | 20 66 69 65 6c 64 20 73 |s "type"| field s|
|000022d0| 65 74 20 74 6f 20 7a 65 | 72 6f 2e 20 28 54 68 61 |et to ze|ro. (Tha|
|000022e0| 6e 6b 73 0d 09 09 09 74 | 6f 20 45 76 61 6e 20 52 |nks....t|o Evan R|
|000022f0| 65 6c 6b 69 6e 20 66 6f | 72 20 70 6f 69 6e 74 69 |elkin fo|r pointi|
|00002300| 6e 67 20 6f 75 74 20 74 | 68 65 20 6f 6d 69 73 73 |ng out t|he omiss|
|00002310| 69 6f 6e 2e 29 0d 34 2f | 31 2f 39 32 09 64 67 70 |ion.).4/|1/92.dgp|
|00002320| 09 54 69 64 69 65 64 20 | 75 70 20 74 68 65 20 64 |.Tidied |up the d|
|00002330| 6f 63 75 6d 65 6e 74 61 | 74 69 6f 6e 20 61 62 6f |ocumenta|tion abo|
|00002340| 76 65 2e 0d 34 2f 32 2f | 39 32 09 64 67 70 20 49 |ve..4/2/|92.dgp I|
|00002350| 6e 74 72 6f 64 75 63 65 | 64 20 52 65 61 64 41 73 |ntroduce|d ReadAs|
|00002360| 73 69 67 6e 6d 65 6e 74 | 42 6c 6f 63 6b 28 29 20 |signment|Block() |
|00002370| 61 6e 64 20 41 73 73 69 | 67 6e 6d 65 6e 74 4c 69 |and Assi|gnmentLi|
|00002380| 6e 65 57 61 73 42 6c 61 | 6e 6b 28 29 2e 20 0d 09 |neWasBla|nk(). ..|
|00002390| 09 09 44 65 6c 65 74 65 | 64 20 52 65 61 64 41 73 |..Delete|d ReadAs|
|000023a0| 73 69 67 6e 6d 65 6e 74 | 73 28 29 2e 0d 34 2f 35 |signment|s()..4/5|
|000023b0| 2f 39 32 09 64 67 70 09 | 52 65 61 64 41 73 73 69 |/92.dgp.|ReadAssi|
|000023c0| 67 6e 6d 65 6e 74 46 69 | 6c 65 28 29 20 6e 6f 77 |gnmentFi|le() now|
|000023d0| 20 63 6c 6f 73 65 73 20 | 74 68 65 20 66 69 6c 65 | closes |the file|
|000023e0| 20 62 65 66 6f 72 65 20 | 72 65 74 75 72 6e 69 6e | before |returnin|
|000023f0| 67 2e 0d 34 2f 31 37 2f | 39 32 09 64 67 70 09 45 |g..4/17/|92.dgp.E|
|00002400| 78 70 61 6e 64 65 64 20 | 74 68 65 20 65 78 70 6c |xpanded |the expl|
|00002410| 61 6e 61 74 69 6f 6e 20 | 6f 66 20 65 63 68 6f 2c |anation |of echo,|
|00002420| 20 61 73 20 72 65 71 75 | 65 73 74 65 64 20 62 79 | as requ|ested by|
|00002430| 20 45 76 61 6e 20 52 65 | 6c 6b 69 6e 2e 0d 35 2f | Evan Re|lkin..5/|
|00002440| 31 34 2f 39 32 09 64 67 | 70 09 45 78 70 61 6e 64 |14/92.dg|p.Expand|
|00002450| 65 64 20 74 68 65 20 65 | 78 70 6c 61 6e 61 74 69 |ed the e|xplanati|
|00002460| 6f 6e 20 6f 66 20 73 74 | 72 69 6e 67 54 79 70 65 |on of st|ringType|
|00002470| 2c 20 22 22 2e 0d 38 2f | 34 2f 39 32 09 64 67 70 |, ""..8/|4/92.dgp|
|00002480| 09 41 64 64 65 64 20 50 | 72 69 6e 74 41 73 73 69 |.Added P|rintAssi|
|00002490| 67 6e 6d 65 6e 74 28 29 | 2c 20 77 68 69 63 68 20 |gnment()|, which |
|000024a0| 70 72 69 6e 74 73 20 6f | 75 74 20 74 68 65 20 76 |prints o|ut the v|
|000024b0| 61 6c 75 65 20 6f 66 20 | 61 20 76 61 72 69 61 62 |alue of |a variab|
|000024c0| 6c 65 2c 0d 09 09 09 61 | 73 20 61 6e 20 61 73 73 |le,....a|s an ass|
|000024d0| 69 67 6e 6d 65 6e 74 20 | 73 74 61 74 65 6d 65 6e |ignment |statemen|
|000024e0| 74 2c 20 73 75 69 74 61 | 62 6c 65 20 66 6f 72 20 |t, suita|ble for |
|000024f0| 72 65 61 64 69 6e 67 20 | 62 79 20 74 68 65 20 52 |reading |by the R|
|00002500| 65 61 64 41 73 73 69 67 | 6e 6d 65 6e 74 0d 09 09 |eadAssig|nment...|
|00002510| 09 72 6f 75 74 69 6e 65 | 73 2e 0d 31 30 2f 32 34 |.routine|s..10/24|
|00002520| 2f 39 32 20 64 67 70 20 | 45 6c 69 6d 69 6e 61 74 |/92 dgp |Eliminat|
|00002530| 65 64 20 64 6f 75 62 6c | 65 20 73 70 61 63 69 6e |ed doubl|e spacin|
|00002540| 67 20 74 68 61 74 20 6f | 63 63 75 72 72 65 64 20 |g that o|ccurred |
|00002550| 61 66 74 65 72 20 2f 2f | 2d 73 74 79 6c 65 20 63 |after //|-style c|
|00002560| 6f 6d 6d 65 6e 74 20 77 | 68 65 6e 20 0d 09 09 09 |omment w|hen ....|
|00002570| 65 63 68 6f 43 6f 6d 6d | 65 6e 74 20 77 61 73 20 |echoComm|ent was |
|00002580| 72 65 71 75 65 73 74 65 | 64 2e 0d 33 2f 34 2f 39 |requeste|d..3/4/9|
|00002590| 33 09 64 67 70 09 63 68 | 61 6e 67 65 64 20 74 68 |3.dgp.ch|anged th|
|000025a0| 65 20 64 65 66 69 6e 69 | 74 69 6f 6e 20 6f 66 20 |e defini|tion of |
|000025b0| 65 6d 70 74 79 53 74 72 | 69 6e 67 20 73 6c 69 67 |emptyStr|ing slig|
|000025c0| 68 74 6c 79 20 73 6f 20 | 74 68 61 74 20 74 68 69 |htly so |that thi|
|000025d0| 73 20 66 69 6c 65 20 63 | 6f 75 6c 64 20 62 65 0d |s file c|ould be.|
|000025e0| 09 09 09 63 6f 6d 70 69 | 6c 65 64 20 61 73 20 61 |...compi|led as a|
|000025f0| 20 63 6f 64 65 20 72 65 | 73 6f 75 72 63 65 2e 0d | code re|source..|
|00002600| 23 65 6e 64 69 66 0d 23 | 69 6e 63 6c 75 64 65 20 |#endif.#|include |
|00002610| 22 56 69 64 65 6f 54 6f | 6f 6c 62 6f 78 2e 68 22 |"VideoTo|olbox.h"|
|00002620| 0d 0d 2f 2a 20 74 68 65 | 20 66 6f 6c 6c 6f 77 69 |../* the| followi|
|00002630| 6e 67 20 61 72 65 20 70 | 72 69 76 61 74 65 2c 20 |ng are p|rivate, |
|00002640| 6e 6f 74 20 69 6e 74 65 | 6e 64 65 64 20 66 6f 72 |not inte|nded for|
|00002650| 20 75 73 65 20 6f 75 74 | 73 69 64 65 20 74 68 69 | use out|side thi|
|00002660| 73 20 66 69 6c 65 20 2a | 2f 0d 73 74 61 74 69 63 |s file *|/.static|
|00002670| 20 42 6f 6f 6c 65 61 6e | 20 6c 69 6e 65 57 61 73 | Boolean| lineWas|
|00002680| 42 6c 61 6e 6b 3d 31 3b | 09 2f 2a 20 75 73 65 64 |Blank=1;|./* used|
|00002690| 20 69 6e 20 52 65 61 64 | 41 73 73 69 67 6e 6d 65 | in Read|Assignme|
|000026a0| 6e 74 4c 69 6e 65 28 29 | 2c 09 2a 2f 0d 09 09 09 |ntLine()|,.*/....|
|000026b0| 09 09 09 09 09 2f 2a 20 | 47 65 74 54 6f 6b 65 6e |...../* |GetToken|
|000026c0| 31 28 29 2c 20 61 6e 64 | 20 41 73 73 69 67 6e 6d |1(), and| Assignm|
|000026d0| 65 6e 74 4c 69 6e 65 57 | 61 73 42 6c 61 6e 6b 28 |entLineW|asBlank(|
|000026e0| 29 2e 2a 2f 0d 76 6f 69 | 64 20 50 61 72 73 69 6e |).*/.voi|d Parsin|
|000026f0| 67 45 72 72 6f 72 28 63 | 68 61 72 20 2a 73 29 3b |gError(c|har *s);|
|00002700| 0d 63 68 61 72 20 2a 47 | 65 74 54 6f 6b 65 6e 28 |.char *G|etToken(|
|00002710| 46 49 4c 45 20 2a 66 69 | 6c 65 2c 63 68 61 72 20 |FILE *fi|le,char |
|00002720| 2a 6c 69 6e 65 42 75 66 | 66 65 72 2c 63 68 61 72 |*lineBuf|fer,char|
|00002730| 20 2a 73 2c 69 6e 74 20 | 65 63 68 6f 29 3b 0d 63 | *s,int |echo);.c|
|00002740| 68 61 72 20 2a 47 65 74 | 54 6f 6b 65 6e 30 28 46 |har *Get|Token0(F|
|00002750| 49 4c 45 20 2a 66 69 6c | 65 2c 63 68 61 72 20 2a |ILE *fil|e,char *|
|00002760| 6c 69 6e 65 42 75 66 66 | 65 72 2c 63 68 61 72 20 |lineBuff|er,char |
|00002770| 2a 73 2c 69 6e 74 20 65 | 63 68 6f 29 3b 0d 63 68 |*s,int e|cho);.ch|
|00002780| 61 72 20 2a 47 65 74 54 | 6f 6b 65 6e 31 28 46 49 |ar *GetT|oken1(FI|
|00002790| 4c 45 20 2a 66 69 6c 65 | 2c 63 68 61 72 20 2a 6c |LE *file|,char *l|
|000027a0| 69 6e 65 42 75 66 66 65 | 72 2c 63 68 61 72 20 2a |ineBuffe|r,char *|
|000027b0| 73 2c 69 6e 74 20 65 63 | 68 6f 29 3b 0d 64 6f 75 |s,int ec|ho);.dou|
|000027c0| 62 6c 65 20 73 74 72 74 | 6f 64 4e 28 63 68 61 72 |ble strt|odN(char|
|000027d0| 20 2a 73 2c 63 68 61 72 | 20 2a 2a 73 50 74 72 29 | *s,char| **sPtr)|
|000027e0| 3b 0d 6c 6f 6e 67 20 73 | 74 72 74 6f 6c 4e 28 63 |;.long s|trtolN(c|
|000027f0| 68 61 72 20 2a 73 2c 63 | 68 61 72 20 2a 2a 73 50 |har *s,c|har **sP|
|00002800| 74 72 2c 73 68 6f 72 74 | 20 66 6c 61 67 29 3b 0d |tr,short| flag);.|
|00002810| 75 6e 73 69 67 6e 65 64 | 20 6c 6f 6e 67 20 73 74 |unsigned| long st|
|00002820| 72 74 6f 75 6c 4e 28 63 | 68 61 72 20 2a 73 2c 63 |rtoulN(c|har *s,c|
|00002830| 68 61 72 20 2a 2a 73 50 | 74 72 2c 73 68 6f 72 74 |har **sP|tr,short|
|00002840| 20 66 6c 61 67 29 3b 0d | 63 68 61 72 20 73 74 72 | flag);.|char str|
|00002850| 74 6f 63 28 63 68 61 72 | 20 2a 73 2c 63 68 61 72 |toc(char| *s,char|
|00002860| 20 2a 2a 73 50 74 72 29 | 3b 0d 23 64 65 66 69 6e | **sPtr)|;.#defin|
|00002870| 65 20 73 74 72 65 71 32 | 28 73 31 2c 73 32 29 20 |e streq2|(s1,s2) |
|00002880| 28 73 74 72 6e 63 6d 70 | 28 73 31 2c 73 32 2c 73 |(strncmp|(s1,s2,s|
|00002890| 74 72 6c 65 6e 28 73 32 | 29 29 3d 3d 30 29 0d 0d |trlen(s2|))==0)..|
|000028a0| 23 64 65 66 69 6e 65 20 | 45 43 48 4f 5f 41 53 53 |#define |ECHO_ASS|
|000028b0| 49 47 4e 4d 45 4e 54 53 | 09 28 65 63 68 6f 20 26 |IGNMENTS|.(echo &|
|000028c0| 20 65 63 68 6f 41 73 73 | 69 67 6e 6d 65 6e 74 73 | echoAss|ignments|
|000028d0| 29 0d 23 64 65 66 69 6e | 65 20 45 43 48 4f 5f 43 |).#defin|e ECHO_C|
|000028e0| 4f 4d 4d 45 4e 54 53 09 | 09 28 65 63 68 6f 20 26 |OMMENTS.|.(echo &|
|000028f0| 20 65 63 68 6f 43 6f 6d | 6d 65 6e 74 73 29 0d 23 | echoCom|ments).#|
|00002900| 64 65 66 69 6e 65 20 45 | 43 48 4f 5f 46 49 4c 45 |define E|CHO_FILE|
|00002910| 09 09 09 28 65 63 68 6f | 20 26 20 65 63 68 6f 46 |...(echo| & echoF|
|00002920| 69 6c 65 29 0d 23 64 65 | 66 69 6e 65 20 42 55 46 |ile).#de|fine BUF|
|00002930| 46 45 52 5f 53 49 5a 45 | 20 35 31 32 0d 0d 76 6f |FER_SIZE| 512..vo|
|00002940| 69 64 20 50 72 69 6e 74 | 41 73 73 69 67 6e 6d 65 |id Print|Assignme|
|00002950| 6e 74 28 46 49 4c 45 20 | 2a 66 69 6c 65 2c 56 61 |nt(FILE |*file,Va|
|00002960| 72 69 61 62 6c 65 20 2a | 76 29 0d 7b 0d 09 66 70 |riable *|v).{..fp|
|00002970| 72 69 6e 74 66 28 66 69 | 6c 65 2c 22 25 73 3d 22 |rintf(fi|le,"%s="|
|00002980| 2c 76 2d 3e 6e 61 6d 65 | 29 3b 0d 09 73 77 69 74 |,v->name|);..swit|
|00002990| 63 68 28 76 2d 3e 74 79 | 70 65 29 7b 0d 09 64 65 |ch(v->ty|pe){..de|
|000029a0| 66 61 75 6c 74 3a 0d 09 | 09 50 72 69 6e 74 66 45 |fault:..|.PrintfE|
|000029b0| 78 69 74 28 22 5c 6e 50 | 72 69 6e 74 56 61 72 69 |xit("\nP|rintVari|
|000029c0| 61 62 6c 65 3a 20 25 73 | 20 68 61 73 20 75 6e 6b |able: %s| has unk|
|000029d0| 6e 6f 77 6e 20 74 79 70 | 65 20 25 64 2e 5c 6e 5c |nown typ|e %d.\n\|
|000029e0| 30 30 37 22 2c 76 2d 3e | 6e 61 6d 65 2c 76 2d 3e |007",v->|name,v->|
|000029f0| 74 79 70 65 29 3b 0d 09 | 63 61 73 65 20 63 68 61 |type);..|case cha|
|00002a00| 72 54 79 70 65 3a 0d 09 | 09 69 66 28 69 73 61 6c |rType:..|.if(isal|
|00002a10| 6e 75 6d 28 2a 28 75 6e | 73 69 67 6e 65 64 20 63 |num(*(un|signed c|
|00002a20| 68 61 72 20 2a 29 76 2d | 3e 70 74 72 29 29 0d 09 |har *)v-|>ptr))..|
|00002a30| 09 09 66 70 72 69 6e 74 | 66 28 66 69 6c 65 2c 22 |..fprint|f(file,"|
|00002a40| 27 25 63 27 3b 5c 6e 22 | 2c 2a 28 75 6e 73 69 67 |'%c';\n"|,*(unsig|
|00002a50| 6e 65 64 20 63 68 61 72 | 20 2a 29 76 2d 3e 70 74 |ned char| *)v->pt|
|00002a60| 72 29 3b 0d 09 09 65 6c | 73 65 0d 09 09 09 66 70 |r);...el|se....fp|
|00002a70| 72 69 6e 74 66 28 66 69 | 6c 65 2c 22 25 64 3b 5c |rintf(fi|le,"%d;\|
|00002a80| 6e 22 2c 2a 28 63 68 61 | 72 20 2a 29 76 2d 3e 70 |n",*(cha|r *)v->p|
|00002a90| 74 72 29 3b 0d 09 09 62 | 72 65 61 6b 3b 0d 09 63 |tr);...b|reak;..c|
|00002aa0| 61 73 65 20 75 6e 73 69 | 67 6e 65 64 43 68 61 72 |ase unsi|gnedChar|
|00002ab0| 54 79 70 65 3a 0d 09 09 | 69 66 28 69 73 61 6c 6e |Type:...|if(isaln|
|00002ac0| 75 6d 28 2a 28 75 6e 73 | 69 67 6e 65 64 20 63 68 |um(*(uns|igned ch|
|00002ad0| 61 72 20 2a 29 76 2d 3e | 70 74 72 29 29 0d 09 09 |ar *)v->|ptr))...|
|00002ae0| 09 66 70 72 69 6e 74 66 | 28 66 69 6c 65 2c 22 27 |.fprintf|(file,"'|
|00002af0| 25 63 27 3b 5c 6e 22 2c | 2a 28 75 6e 73 69 67 6e |%c';\n",|*(unsign|
|00002b00| 65 64 20 63 68 61 72 20 | 2a 29 76 2d 3e 70 74 72 |ed char |*)v->ptr|
|00002b10| 29 3b 0d 09 09 65 6c 73 | 65 0d 09 09 09 66 70 72 |);...els|e....fpr|
|00002b20| 69 6e 74 66 28 66 69 6c | 65 2c 22 25 64 3b 5c 6e |intf(fil|e,"%d;\n|
|00002b30| 22 2c 2a 28 75 6e 73 69 | 67 6e 65 64 20 63 68 61 |",*(unsi|gned cha|
|00002b40| 72 20 2a 29 76 2d 3e 70 | 74 72 29 3b 0d 09 09 62 |r *)v->p|tr);...b|
|00002b50| 72 65 61 6b 3b 0d 09 63 | 61 73 65 20 73 68 6f 72 |reak;..c|ase shor|
|00002b60| 74 54 79 70 65 3a 0d 09 | 09 66 70 72 69 6e 74 66 |tType:..|.fprintf|
|00002b70| 28 66 69 6c 65 2c 22 25 | 64 3b 5c 6e 22 2c 2a 28 |(file,"%|d;\n",*(|
|00002b80| 73 68 6f 72 74 20 2a 29 | 76 2d 3e 70 74 72 29 3b |short *)|v->ptr);|
|00002b90| 0d 09 09 62 72 65 61 6b | 3b 0d 09 63 61 73 65 20 |...break|;..case |
|00002ba0| 75 6e 73 69 67 6e 65 64 | 53 68 6f 72 74 54 79 70 |unsigned|ShortTyp|
|00002bb0| 65 3a 0d 09 09 66 70 72 | 69 6e 74 66 28 66 69 6c |e:...fpr|intf(fil|
|00002bc0| 65 2c 22 25 75 3b 5c 6e | 22 2c 2a 28 75 6e 73 69 |e,"%u;\n|",*(unsi|
|00002bd0| 67 6e 65 64 20 73 68 6f | 72 74 20 2a 29 76 2d 3e |gned sho|rt *)v->|
|00002be0| 70 74 72 29 3b 0d 09 09 | 62 72 65 61 6b 3b 0d 09 |ptr);...|break;..|
|00002bf0| 63 61 73 65 20 6c 6f 6e | 67 54 79 70 65 3a 0d 09 |case lon|gType:..|
|00002c00| 09 66 70 72 69 6e 74 66 | 28 66 69 6c 65 2c 22 25 |.fprintf|(file,"%|
|00002c10| 6c 64 3b 5c 6e 22 2c 2a | 28 6c 6f 6e 67 20 2a 29 |ld;\n",*|(long *)|
|00002c20| 76 2d 3e 70 74 72 29 3b | 0d 09 09 62 72 65 61 6b |v->ptr);|...break|
|00002c30| 3b 0d 09 63 61 73 65 20 | 75 6e 73 69 67 6e 65 64 |;..case |unsigned|
|00002c40| 4c 6f 6e 67 54 79 70 65 | 3a 0d 09 09 66 70 72 69 |LongType|:...fpri|
|00002c50| 6e 74 66 28 66 69 6c 65 | 2c 22 25 6c 75 3b 5c 6e |ntf(file|,"%lu;\n|
|00002c60| 22 2c 2a 28 75 6e 73 69 | 67 6e 65 64 20 6c 6f 6e |",*(unsi|gned lon|
|00002c70| 67 20 2a 29 76 2d 3e 70 | 74 72 29 3b 0d 09 09 62 |g *)v->p|tr);...b|
|00002c80| 72 65 61 6b 3b 0d 09 63 | 61 73 65 20 64 6f 75 62 |reak;..c|ase doub|
|00002c90| 6c 65 54 79 70 65 3a 0d | 09 09 66 70 72 69 6e 74 |leType:.|..fprint|
|00002ca0| 66 28 66 69 6c 65 2c 22 | 25 66 3b 5c 6e 22 2c 2a |f(file,"|%f;\n",*|
|00002cb0| 28 64 6f 75 62 6c 65 20 | 2a 29 76 2d 3e 70 74 72 |(double |*)v->ptr|
|00002cc0| 29 3b 0d 09 09 62 72 65 | 61 6b 3b 0d 09 63 61 73 |);...bre|ak;..cas|
|00002cd0| 65 20 73 74 72 69 6e 67 | 54 79 70 65 3a 0d 09 09 |e string|Type:...|
|00002ce0| 66 70 72 69 6e 74 66 28 | 66 69 6c 65 2c 22 5c 22 |fprintf(|file,"\"|
|00002cf0| 25 73 5c 22 3b 5c 6e 22 | 2c 2a 28 63 68 61 72 20 |%s\";\n"|,*(char |
|00002d00| 2a 2a 29 76 2d 3e 70 74 | 72 29 3b 0d 09 09 62 72 |**)v->pt|r);...br|
|00002d10| 65 61 6b 3b 0d 09 7d 0d | 7d 0d 0d 56 61 72 69 61 |eak;..}.|}..Varia|
|00002d20| 62 6c 65 20 53 65 74 56 | 61 72 69 61 62 6c 65 28 |ble SetV|ariable(|
|00002d30| 69 6e 74 20 74 79 70 65 | 2c 76 6f 69 64 20 2a 70 |int type|,void *p|
|00002d40| 74 72 2c 63 68 61 72 20 | 2a 6e 61 6d 65 29 0d 7b |tr,char |*name).{|
|00002d50| 0d 09 73 74 61 74 69 63 | 20 56 61 72 69 61 62 6c |..static| Variabl|
|00002d60| 65 20 76 3b 0d 09 0d 09 | 76 2e 6e 61 6d 65 3d 6e |e v;....|v.name=n|
|00002d70| 61 6d 65 3b 0d 09 76 2e | 70 74 72 3d 70 74 72 3b |ame;..v.|ptr=ptr;|
|00002d80| 0d 09 76 2e 74 79 70 65 | 3d 74 79 70 65 3b 0d 09 |..v.type|=type;..|
|00002d90| 72 65 74 75 72 6e 20 76 | 3b 0d 7d 0d 0d 69 6e 74 |return v|;.}..int|
|00002da0| 20 49 6e 69 74 69 61 6c | 69 7a 65 56 61 72 69 61 | Initial|izeVaria|
|00002db0| 62 6c 65 73 28 56 61 72 | 69 61 62 6c 65 20 76 61 |bles(Var|iable va|
|00002dc0| 72 69 61 62 6c 65 5b 5d | 29 0d 7b 0d 09 69 6e 74 |riable[]|).{..int|
|00002dd0| 20 69 3b 0d 09 0d 09 66 | 6f 72 28 69 3d 30 3b 76 | i;....f|or(i=0;v|
|00002de0| 61 72 69 61 62 6c 65 5b | 69 5d 2e 74 79 70 65 21 |ariable[|i].type!|
|00002df0| 3d 30 3b 69 2b 2b 29 49 | 6e 69 74 69 61 6c 69 7a |=0;i++)I|nitializ|
|00002e00| 65 41 56 61 72 69 61 62 | 6c 65 28 26 76 61 72 69 |eAVariab|le(&vari|
|00002e10| 61 62 6c 65 5b 69 5d 29 | 3b 0d 09 72 65 74 75 72 |able[i])|;..retur|
|00002e20| 6e 20 69 3b 0d 7d 0d 0d | 76 6f 69 64 20 49 6e 69 |n i;.}..|void Ini|
|00002e30| 74 69 61 6c 69 7a 65 41 | 56 61 72 69 61 62 6c 65 |tializeA|Variable|
|00002e40| 28 56 61 72 69 61 62 6c | 65 20 2a 76 29 0d 7b 0d |(Variabl|e *v).{.|
|00002e50| 09 73 74 61 74 69 63 20 | 63 6f 6e 73 74 20 63 68 |.static |const ch|
|00002e60| 61 72 20 65 6d 70 74 79 | 53 74 72 69 6e 67 5b 5d |ar empty|String[]|
|00002e70| 3d 22 22 3b 0d 09 0d 09 | 73 77 69 74 63 68 28 76 |="";....|switch(v|
|00002e80| 2d 3e 74 79 70 65 29 7b | 0d 09 64 65 66 61 75 6c |->type){|..defaul|
|00002e90| 74 3a 0d 09 09 50 72 69 | 6e 74 66 45 78 69 74 28 |t:...Pri|ntfExit(|
|00002ea0| 22 5c 6e 49 6e 69 74 69 | 61 6c 69 7a 65 41 56 61 |"\nIniti|alizeAVa|
|00002eb0| 72 69 61 62 6c 65 3a 20 | 25 73 20 68 61 73 20 75 |riable: |%s has u|
|00002ec0| 6e 6b 6e 6f 77 6e 20 74 | 79 70 65 20 25 64 2e 5c |nknown t|ype %d.\|
|00002ed0| 6e 5c 30 30 37 22 0d 09 | 09 09 2c 76 2d 3e 6e 61 |n\007"..|..,v->na|
|00002ee0| 6d 65 2c 76 2d 3e 74 79 | 70 65 29 3b 0d 09 63 61 |me,v->ty|pe);..ca|
|00002ef0| 73 65 20 63 68 61 72 54 | 79 70 65 3a 0d 09 63 61 |se charT|ype:..ca|
|00002f00| 73 65 20 75 6e 73 69 67 | 6e 65 64 43 68 61 72 54 |se unsig|nedCharT|
|00002f10| 79 70 65 3a 0d 09 09 2a | 28 63 68 61 72 20 2a 29 |ype:...*|(char *)|
|00002f20| 76 2d 3e 70 74 72 3d 30 | 3b 0d 09 09 62 72 65 61 |v->ptr=0|;...brea|
|00002f30| 6b 3b 0d 09 63 61 73 65 | 20 73 68 6f 72 74 54 79 |k;..case| shortTy|
|00002f40| 70 65 3a 0d 09 63 61 73 | 65 20 75 6e 73 69 67 6e |pe:..cas|e unsign|
|00002f50| 65 64 53 68 6f 72 74 54 | 79 70 65 3a 0d 09 09 2a |edShortT|ype:...*|
|00002f60| 28 73 68 6f 72 74 20 2a | 29 76 2d 3e 70 74 72 3d |(short *|)v->ptr=|
|00002f70| 30 3b 0d 09 09 62 72 65 | 61 6b 3b 0d 09 63 61 73 |0;...bre|ak;..cas|
|00002f80| 65 20 6c 6f 6e 67 54 79 | 70 65 3a 0d 09 63 61 73 |e longTy|pe:..cas|
|00002f90| 65 20 75 6e 73 69 67 6e | 65 64 4c 6f 6e 67 54 79 |e unsign|edLongTy|
|00002fa0| 70 65 3a 0d 09 09 2a 28 | 6c 6f 6e 67 20 2a 29 76 |pe:...*(|long *)v|
|00002fb0| 2d 3e 70 74 72 3d 30 3b | 0d 09 09 62 72 65 61 6b |->ptr=0;|...break|
|00002fc0| 3b 0d 09 63 61 73 65 20 | 64 6f 75 62 6c 65 54 79 |;..case |doubleTy|
|00002fd0| 70 65 3a 0d 09 09 2a 28 | 64 6f 75 62 6c 65 20 2a |pe:...*(|double *|
|00002fe0| 29 76 2d 3e 70 74 72 3d | 4e 41 4e 3b 0d 09 09 62 |)v->ptr=|NAN;...b|
|00002ff0| 72 65 61 6b 3b 0d 09 63 | 61 73 65 20 73 74 72 69 |reak;..c|ase stri|
|00003000| 6e 67 54 79 70 65 3a 0d | 09 09 2a 28 63 6f 6e 73 |ngType:.|..*(cons|
|00003010| 74 20 63 68 61 72 20 2a | 2a 29 76 2d 3e 70 74 72 |t char *|*)v->ptr|
|00003020| 3d 65 6d 70 74 79 53 74 | 72 69 6e 67 3b 0d 09 09 |=emptySt|ring;...|
|00003030| 62 72 65 61 6b 3b 0d 09 | 7d 0d 7d 0d 0d 42 6f 6f |break;..|}.}..Boo|
|00003040| 6c 65 61 6e 20 41 73 73 | 69 67 6e 6d 65 6e 74 4c |lean Ass|ignmentL|
|00003050| 69 6e 65 57 61 73 42 6c | 61 6e 6b 28 76 6f 69 64 |ineWasBl|ank(void|
|00003060| 29 0d 7b 0d 09 65 78 74 | 65 72 6e 20 42 6f 6f 6c |).{..ext|ern Bool|
|00003070| 65 61 6e 20 6c 69 6e 65 | 57 61 73 42 6c 61 6e 6b |ean line|WasBlank|
|00003080| 3b 0d 0d 09 72 65 74 75 | 72 6e 20 6c 69 6e 65 57 |;...retu|rn lineW|
|00003090| 61 73 42 6c 61 6e 6b 3b | 0d 7d 0d 0d 69 6e 74 20 |asBlank;|.}..int |
|000030a0| 52 65 61 64 41 73 73 69 | 67 6e 6d 65 6e 74 42 6c |ReadAssi|gnmentBl|
|000030b0| 6f 63 6b 28 46 49 4c 45 | 20 2a 66 69 6c 65 2c 56 |ock(FILE| *file,V|
|000030c0| 61 72 69 61 62 6c 65 20 | 76 61 72 69 61 62 6c 65 |ariable |variable|
|000030d0| 5b 5d 2c 69 6e 74 20 65 | 63 68 6f 29 0d 7b 0d 09 |[],int e|cho).{..|
|000030e0| 69 6e 74 20 6e 3b 0d 09 | 0d 09 6e 3d 30 3b 0d 09 |int n;..|..n=0;..|
|000030f0| 64 6f 7b 0d 09 09 6e 2b | 3d 52 65 61 64 41 73 73 |do{...n+|=ReadAss|
|00003100| 69 67 6e 6d 65 6e 74 4c | 69 6e 65 28 66 69 6c 65 |ignmentL|ine(file|
|00003110| 2c 76 61 72 69 61 62 6c | 65 2c 65 63 68 6f 29 3b |,variabl|e,echo);|
|00003120| 0d 09 7d 77 68 69 6c 65 | 28 21 41 73 73 69 67 6e |..}while|(!Assign|
|00003130| 6d 65 6e 74 4c 69 6e 65 | 57 61 73 42 6c 61 6e 6b |mentLine|WasBlank|
|00003140| 28 29 29 3b 0d 09 72 65 | 74 75 72 6e 20 6e 3b 0d |());..re|turn n;.|
|00003150| 7d 0d 0d 69 6e 74 20 52 | 65 61 64 41 73 73 69 67 |}..int R|eadAssig|
|00003160| 6e 6d 65 6e 74 46 69 6c | 65 28 63 68 61 72 20 2a |nmentFil|e(char *|
|00003170| 66 69 6c 65 6e 61 6d 65 | 2c 56 61 72 69 61 62 6c |filename|,Variabl|
|00003180| 65 20 76 61 72 69 61 62 | 6c 65 5b 5d 2c 69 6e 74 |e variab|le[],int|
|00003190| 20 65 63 68 6f 29 0d 7b | 0d 09 69 6e 74 20 6e 3b | echo).{|..int n;|
|000031a0| 0d 09 46 49 4c 45 20 2a | 66 69 6c 65 3b 0d 09 0d |..FILE *|file;...|
|000031b0| 09 66 69 6c 65 3d 66 6f | 70 65 6e 28 66 69 6c 65 |.file=fo|pen(file|
|000031c0| 6e 61 6d 65 2c 22 72 22 | 29 3b 0d 09 69 66 28 66 |name,"r"|);..if(f|
|000031d0| 69 6c 65 3d 3d 4e 55 4c | 4c 29 72 65 74 75 72 6e |ile==NUL|L)return|
|000031e0| 20 2d 31 3b 09 2f 2a 20 | 65 72 72 6f 72 20 2a 2f | -1;./* |error */|
|000031f0| 0d 09 6e 3d 30 3b 0d 09 | 64 6f 7b 0d 09 09 6e 2b |..n=0;..|do{...n+|
|00003200| 3d 52 65 61 64 41 73 73 | 69 67 6e 6d 65 6e 74 4c |=ReadAss|ignmentL|
|00003210| 69 6e 65 28 66 69 6c 65 | 2c 76 61 72 69 61 62 6c |ine(file|,variabl|
|00003220| 65 2c 65 63 68 6f 29 3b | 0d 09 7d 77 68 69 6c 65 |e,echo);|..}while|
|00003230| 28 21 66 65 6f 66 28 66 | 69 6c 65 29 29 3b 0d 09 |(!feof(f|ile));..|
|00003240| 66 63 6c 6f 73 65 28 66 | 69 6c 65 29 3b 0d 09 72 |fclose(f|ile);..r|
|00003250| 65 74 75 72 6e 20 6e 3b | 0d 7d 0d 0d 73 74 61 74 |eturn n;|.}..stat|
|00003260| 69 63 20 63 68 61 72 20 | 2a 6c 69 6e 65 42 75 66 |ic char |*lineBuf|
|00003270| 66 65 72 3b 09 2f 2a 20 | 67 6c 6f 62 61 6c 20 62 |fer;./* |global b|
|00003280| 65 63 61 75 73 65 20 69 | 74 20 77 6f 75 6c 64 20 |ecause i|t would |
|00003290| 62 65 20 6d 65 73 73 79 | 20 74 6f 20 70 61 73 73 |be messy| to pass|
|000032a0| 20 74 68 69 73 20 61 64 | 64 72 65 73 73 20 74 6f | this ad|dress to|
|000032b0| 0d 09 09 09 09 09 09 09 | 61 6c 6c 20 74 68 65 20 |........|all the |
|000032c0| 72 6f 75 74 69 6e 65 73 | 20 62 65 6c 6f 77 20 74 |routines| below t|
|000032d0| 68 61 74 20 6e 65 65 64 | 20 74 6f 20 63 61 6c 6c |hat need| to call|
|000032e0| 20 50 61 72 73 69 6e 67 | 45 72 72 6f 72 20 2a 2f | Parsing|Error */|
|000032f0| 0d 0d 69 6e 74 20 52 65 | 61 64 41 73 73 69 67 6e |..int Re|adAssign|
|00003300| 6d 65 6e 74 4c 69 6e 65 | 28 46 49 4c 45 20 2a 66 |mentLine|(FILE *f|
|00003310| 69 6c 65 2c 56 61 72 69 | 61 62 6c 65 20 76 61 72 |ile,Vari|able var|
|00003320| 69 61 62 6c 65 5b 5d 2c | 69 6e 74 20 65 63 68 6f |iable[],|int echo|
|00003330| 29 0d 7b 0d 09 72 65 67 | 69 73 74 65 72 20 56 61 |).{..reg|ister Va|
|00003340| 72 69 61 62 6c 65 20 2a | 76 3b 0d 09 56 61 72 69 |riable *|v;..Vari|
|00003350| 61 62 6c 65 20 2a 76 4c | 61 73 74 2c 2a 77 3b 0d |able *vL|ast,*w;.|
|00003360| 09 69 6e 74 20 6a 2c 6e | 3b 0d 09 63 68 61 72 20 |.int j,n|;..char |
|00003370| 2a 73 2c 2a 73 32 2c 2a | 73 74 72 69 6e 67 42 75 |*s,*s2,*|stringBu|
|00003380| 66 66 65 72 3b 0d 09 65 | 78 74 65 72 6e 20 42 6f |ffer;..e|xtern Bo|
|00003390| 6f 6c 65 61 6e 20 6c 69 | 6e 65 57 61 73 42 6c 61 |olean li|neWasBla|
|000033a0| 6e 6b 3b 0d 09 0d 09 6c | 69 6e 65 57 61 73 42 6c |nk;....l|ineWasBl|
|000033b0| 61 6e 6b 3d 54 52 55 45 | 3b 0d 09 6c 69 6e 65 42 |ank=TRUE|;..lineB|
|000033c0| 75 66 66 65 72 3d 28 63 | 68 61 72 20 2a 29 6d 61 |uffer=(c|har *)ma|
|000033d0| 6c 6c 6f 63 28 42 55 46 | 46 45 52 5f 53 49 5a 45 |lloc(BUF|FER_SIZE|
|000033e0| 29 3b 0d 09 73 74 72 69 | 6e 67 42 75 66 66 65 72 |);..stri|ngBuffer|
|000033f0| 3d 28 63 68 61 72 20 2a | 29 6d 61 6c 6c 6f 63 28 |=(char *|)malloc(|
|00003400| 42 55 46 46 45 52 5f 53 | 49 5a 45 29 3b 0d 09 69 |BUFFER_S|IZE);..i|
|00003410| 66 28 6c 69 6e 65 42 75 | 66 66 65 72 3d 3d 4e 55 |f(lineBu|ffer==NU|
|00003420| 4c 4c 7c 7c 73 74 72 69 | 6e 67 42 75 66 66 65 72 |LL||stri|ngBuffer|
|00003430| 3d 3d 4e 55 4c 4c 29 7b | 0d 09 09 50 72 69 6e 74 |==NULL){|...Print|
|00003440| 66 45 78 69 74 28 22 52 | 65 61 64 41 73 73 69 67 |fExit("R|eadAssig|
|00003450| 6e 6d 65 6e 74 4c 69 6e | 65 3a 20 63 6f 75 6c 64 |nmentLin|e: could|
|00003460| 6e 27 74 20 6d 61 6c 6c | 6f 63 20 25 64 20 62 79 |n't mall|oc %d by|
|00003470| 74 65 73 20 66 6f 72 20 | 62 75 66 66 65 72 73 2e |tes for |buffers.|
|00003480| 5c 30 30 37 5c 6e 22 0d | 09 09 09 2c 32 2a 42 55 |\007\n".|...,2*BU|
|00003490| 46 46 45 52 5f 53 49 5a | 45 29 3b 0d 09 7d 0d 09 |FFER_SIZ|E);..}..|
|000034a0| 69 66 28 66 69 6c 65 3d | 3d 4e 55 4c 4c 29 72 65 |if(file=|=NULL)re|
|000034b0| 74 75 72 6e 20 30 3b 0d | 09 66 6f 72 28 76 4c 61 |turn 0;.|.for(vLa|
|000034c0| 73 74 3d 26 76 61 72 69 | 61 62 6c 65 5b 30 5d 3b |st=&vari|able[0];|
|000034d0| 76 4c 61 73 74 2d 3e 74 | 79 70 65 3e 30 3b 76 4c |vLast->t|ype>0;vL|
|000034e0| 61 73 74 2b 2b 29 3b 0d | 09 76 4c 61 73 74 2d 3e |ast++);.|.vLast->|
|000034f0| 6e 61 6d 65 3d 22 22 3b | 0d 09 76 4c 61 73 74 2d |name="";|..vLast-|
|00003500| 3e 70 74 72 3d 4e 55 4c | 4c 3b 0d 09 73 3d 4e 55 |>ptr=NUL|L;..s=NU|
|00003510| 4c 4c 3b 0d 09 6e 3d 30 | 3b 0d 09 64 6f 7b 0d 09 |LL;..n=0|;..do{..|
|00003520| 09 2f 2a 20 70 61 72 73 | 65 20 61 20 70 61 72 61 |./* pars|e a para|
|00003530| 6d 65 74 65 72 20 6e 61 | 6d 65 20 2a 2f 0d 09 09 |meter na|me */...|
|00003540| 69 66 28 73 3d 3d 4e 55 | 4c 4c 29 20 73 3d 47 65 |if(s==NU|LL) s=Ge|
|00003550| 74 54 6f 6b 65 6e 31 28 | 66 69 6c 65 2c 6c 69 6e |tToken1(|file,lin|
|00003560| 65 42 75 66 66 65 72 2c | 73 2c 65 63 68 6f 29 3b |eBuffer,|s,echo);|
|00003570| 2f 2a 20 72 65 61 64 20 | 69 6e 20 61 20 6e 65 77 |/* read |in a new|
|00003580| 20 6c 69 6e 65 20 2a 2f | 0d 09 09 65 6c 73 65 20 | line */|...else |
|00003590| 73 3d 47 65 74 54 6f 6b | 65 6e 30 28 66 69 6c 65 |s=GetTok|en0(file|
|000035a0| 2c 6c 69 6e 65 42 75 66 | 66 65 72 2c 73 2c 65 63 |,lineBuf|fer,s,ec|
|000035b0| 68 6f 29 3b 09 09 2f 2a | 20 64 6f 6e 27 74 20 72 |ho);../*| don't r|
|000035c0| 65 61 64 20 69 6e 20 61 | 20 6e 65 77 20 6c 69 6e |ead in a| new lin|
|000035d0| 65 20 2a 2f 0d 09 09 69 | 66 28 73 3d 3d 4e 55 4c |e */...i|f(s==NUL|
|000035e0| 4c 29 7b 0d 09 09 09 66 | 72 65 65 28 6c 69 6e 65 |L){....f|ree(line|
|000035f0| 42 75 66 66 65 72 29 3b | 0d 09 09 09 66 72 65 65 |Buffer);|....free|
|00003600| 28 73 74 72 69 6e 67 42 | 75 66 66 65 72 29 3b 0d |(stringB|uffer);.|
|00003610| 09 09 09 72 65 74 75 72 | 6e 20 6e 3b 0d 09 09 7d |...retur|n n;...}|
|00003620| 0d 09 09 76 3d 76 4c 61 | 73 74 3b 0d 09 09 66 6f |...v=vLa|st;...fo|
|00003630| 72 28 77 3d 26 76 61 72 | 69 61 62 6c 65 5b 30 5d |r(w=&var|iable[0]|
|00003640| 3b 77 21 3d 76 4c 61 73 | 74 3b 77 2b 2b 29 09 09 |;w!=vLas|t;w++)..|
|00003650| 09 09 2f 2a 20 66 69 6e | 64 20 6c 6f 6e 67 65 73 |../* fin|d longes|
|00003660| 74 20 6d 61 74 63 68 20 | 2a 2f 0d 09 09 09 69 66 |t match |*/....if|
|00003670| 28 73 74 72 65 71 32 28 | 73 2c 77 2d 3e 6e 61 6d |(streq2(|s,w->nam|
|00003680| 65 29 26 26 73 74 72 6c | 65 6e 28 77 2d 3e 6e 61 |e)&&strl|en(w->na|
|00003690| 6d 65 29 3e 73 74 72 6c | 65 6e 28 76 2d 3e 6e 61 |me)>strl|en(v->na|
|000036a0| 6d 65 29 29 76 3d 77 3b | 0d 09 09 69 66 28 76 3d |me))v=w;|...if(v=|
|000036b0| 3d 76 4c 61 73 74 29 50 | 61 72 73 69 6e 67 45 72 |=vLast)P|arsingEr|
|000036c0| 72 6f 72 28 73 29 3b 0d | 09 09 73 2b 3d 73 74 72 |ror(s);.|..s+=str|
|000036d0| 6c 65 6e 28 76 2d 3e 6e | 61 6d 65 29 3b 0d 09 09 |len(v->n|ame);...|
|000036e0| 69 66 28 45 43 48 4f 5f | 41 53 53 49 47 4e 4d 45 |if(ECHO_|ASSIGNME|
|000036f0| 4e 54 53 29 70 72 69 6e | 74 66 28 22 25 73 22 2c |NTS)prin|tf("%s",|
|00003700| 76 2d 3e 6e 61 6d 65 29 | 3b 0d 09 09 0d 09 09 2f |v->name)|;....../|
|00003710| 2a 20 70 61 72 73 65 20 | 74 68 65 20 65 71 75 61 |* parse |the equa|
|00003720| 6c 20 73 69 67 6e 20 2a | 2f 0d 09 09 73 3d 47 65 |l sign *|/...s=Ge|
|00003730| 74 54 6f 6b 65 6e 28 66 | 69 6c 65 2c 6c 69 6e 65 |tToken(f|ile,line|
|00003740| 42 75 66 66 65 72 2c 73 | 2c 65 63 68 6f 29 3b 0d |Buffer,s|,echo);.|
|00003750| 09 09 69 66 28 73 3d 3d | 4e 55 4c 4c 29 50 61 72 |..if(s==|NULL)Par|
|00003760| 73 69 6e 67 45 72 72 6f | 72 28 73 29 3b 0d 09 09 |singErro|r(s);...|
|00003770| 69 66 28 73 5b 30 5d 20 | 21 3d 20 27 3d 27 29 50 |if(s[0] |!= '=')P|
|00003780| 61 72 73 69 6e 67 45 72 | 72 6f 72 28 73 29 3b 0d |arsingEr|ror(s);.|
|00003790| 09 09 73 2b 2b 3b 0d 09 | 09 69 66 28 45 43 48 4f |..s++;..|.if(ECHO|
|000037a0| 5f 41 53 53 49 47 4e 4d | 45 4e 54 53 29 70 72 69 |_ASSIGNM|ENTS)pri|
|000037b0| 6e 74 66 28 22 3d 22 29 | 3b 0d 09 09 0d 09 09 2f |ntf("=")|;....../|
|000037c0| 2a 20 70 61 72 73 65 20 | 74 68 65 20 76 61 6c 75 |* parse |the valu|
|000037d0| 65 20 2a 2f 0d 09 09 73 | 3d 47 65 74 54 6f 6b 65 |e */...s|=GetToke|
|000037e0| 6e 28 66 69 6c 65 2c 6c | 69 6e 65 42 75 66 66 65 |n(file,l|ineBuffe|
|000037f0| 72 2c 73 2c 65 63 68 6f | 29 3b 0d 09 09 69 66 28 |r,s,echo|);...if(|
|00003800| 73 3d 3d 4e 55 4c 4c 29 | 50 61 72 73 69 6e 67 45 |s==NULL)|ParsingE|
|00003810| 72 72 6f 72 28 73 29 3b | 0d 09 09 73 77 69 74 63 |rror(s);|...switc|
|00003820| 68 28 76 2d 3e 74 79 70 | 65 29 7b 0d 09 09 64 65 |h(v->typ|e){...de|
|00003830| 66 61 75 6c 74 3a 0d 09 | 09 09 50 72 69 6e 74 66 |fault:..|..Printf|
|00003840| 45 78 69 74 28 22 5c 6e | 52 65 61 64 41 73 73 69 |Exit("\n|ReadAssi|
|00003850| 67 6e 6d 65 6e 74 4c 69 | 6e 65 3a 20 25 73 20 68 |gnmentLi|ne: %s h|
|00003860| 61 73 20 75 6e 6b 6e 6f | 77 6e 20 74 79 70 65 20 |as unkno|wn type |
|00003870| 25 64 2e 5c 6e 5c 30 30 | 37 22 0d 09 09 09 09 2c |%d.\n\00|7".....,|
|00003880| 76 2d 3e 6e 61 6d 65 2c | 76 2d 3e 74 79 70 65 29 |v->name,|v->type)|
|00003890| 3b 0d 09 09 63 61 73 65 | 20 63 68 61 72 54 79 70 |;...case| charTyp|
|000038a0| 65 3a 0d 09 09 09 2a 28 | 63 68 61 72 20 2a 29 76 |e:....*(|char *)v|
|000038b0| 2d 3e 70 74 72 3d 73 74 | 72 74 6f 6c 4e 28 73 2c |->ptr=st|rtolN(s,|
|000038c0| 26 73 2c 30 29 3b 0d 09 | 09 09 69 66 28 45 43 48 |&s,0);..|..if(ECH|
|000038d0| 4f 5f 41 53 53 49 47 4e | 4d 45 4e 54 53 29 70 72 |O_ASSIGN|MENTS)pr|
|000038e0| 69 6e 74 66 28 22 25 64 | 22 2c 2a 28 63 68 61 72 |intf("%d|",*(char|
|000038f0| 20 2a 29 76 2d 3e 70 74 | 72 29 3b 0d 09 09 09 62 | *)v->pt|r);....b|
|00003900| 72 65 61 6b 3b 0d 09 09 | 63 61 73 65 20 73 68 6f |reak;...|case sho|
|00003910| 72 74 54 79 70 65 3a 0d | 09 09 09 2a 28 73 68 6f |rtType:.|...*(sho|
|00003920| 72 74 20 2a 29 76 2d 3e | 70 74 72 3d 73 74 72 74 |rt *)v->|ptr=strt|
|00003930| 6f 6c 4e 28 73 2c 26 73 | 2c 30 29 3b 0d 09 09 09 |olN(s,&s|,0);....|
|00003940| 69 66 28 45 43 48 4f 5f | 41 53 53 49 47 4e 4d 45 |if(ECHO_|ASSIGNME|
|00003950| 4e 54 53 29 70 72 69 6e | 74 66 28 22 25 64 22 2c |NTS)prin|tf("%d",|
|00003960| 2a 28 73 68 6f 72 74 20 | 2a 29 76 2d 3e 70 74 72 |*(short |*)v->ptr|
|00003970| 29 3b 0d 09 09 09 62 72 | 65 61 6b 3b 0d 09 09 63 |);....br|eak;...c|
|00003980| 61 73 65 20 6c 6f 6e 67 | 54 79 70 65 3a 0d 09 09 |ase long|Type:...|
|00003990| 09 2a 28 6c 6f 6e 67 20 | 2a 29 76 2d 3e 70 74 72 |.*(long |*)v->ptr|
|000039a0| 3d 73 74 72 74 6f 6c 4e | 28 73 2c 26 73 2c 30 29 |=strtolN|(s,&s,0)|
|000039b0| 3b 0d 09 09 09 69 66 28 | 45 43 48 4f 5f 41 53 53 |;....if(|ECHO_ASS|
|000039c0| 49 47 4e 4d 45 4e 54 53 | 29 70 72 69 6e 74 66 28 |IGNMENTS|)printf(|
|000039d0| 22 25 6c 64 22 2c 2a 28 | 6c 6f 6e 67 20 2a 29 76 |"%ld",*(|long *)v|
|000039e0| 2d 3e 70 74 72 29 3b 0d | 09 09 09 62 72 65 61 6b |->ptr);.|...break|
|000039f0| 3b 0d 09 09 63 61 73 65 | 20 75 6e 73 69 67 6e 65 |;...case| unsigne|
|00003a00| 64 43 68 61 72 54 79 70 | 65 3a 0d 09 09 09 2a 28 |dCharTyp|e:....*(|
|00003a10| 75 6e 73 69 67 6e 65 64 | 20 63 68 61 72 20 2a 29 |unsigned| char *)|
|00003a20| 76 2d 3e 70 74 72 3d 73 | 74 72 74 6f 75 6c 4e 28 |v->ptr=s|trtoulN(|
|00003a30| 73 2c 26 73 2c 30 29 3b | 0d 09 09 09 69 66 28 45 |s,&s,0);|....if(E|
|00003a40| 43 48 4f 5f 41 53 53 49 | 47 4e 4d 45 4e 54 53 29 |CHO_ASSI|GNMENTS)|
|00003a50| 70 72 69 6e 74 66 28 22 | 25 75 22 2c 2a 28 75 6e |printf("|%u",*(un|
|00003a60| 73 69 67 6e 65 64 20 63 | 68 61 72 20 2a 29 76 2d |signed c|har *)v-|
|00003a70| 3e 70 74 72 29 3b 0d 09 | 09 09 62 72 65 61 6b 3b |>ptr);..|..break;|
|00003a80| 0d 09 09 63 61 73 65 20 | 75 6e 73 69 67 6e 65 64 |...case |unsigned|
|00003a90| 53 68 6f 72 74 54 79 70 | 65 3a 0d 09 09 09 2a 28 |ShortTyp|e:....*(|
|00003aa0| 75 6e 73 69 67 6e 65 64 | 20 73 68 6f 72 74 20 2a |unsigned| short *|
|00003ab0| 29 76 2d 3e 70 74 72 3d | 73 74 72 74 6f 75 6c 4e |)v->ptr=|strtoulN|
|00003ac0| 28 73 2c 26 73 2c 30 29 | 3b 0d 09 09 09 69 66 28 |(s,&s,0)|;....if(|
|00003ad0| 45 43 48 4f 5f 41 53 53 | 49 47 4e 4d 45 4e 54 53 |ECHO_ASS|IGNMENTS|
|00003ae0| 29 70 72 69 6e 74 66 28 | 22 25 75 22 2c 2a 28 75 |)printf(|"%u",*(u|
|00003af0| 6e 73 69 67 6e 65 64 20 | 73 68 6f 72 74 20 2a 29 |nsigned |short *)|
|00003b00| 76 2d 3e 70 74 72 29 3b | 0d 09 09 09 62 72 65 61 |v->ptr);|....brea|
|00003b10| 6b 3b 0d 09 09 63 61 73 | 65 20 75 6e 73 69 67 6e |k;...cas|e unsign|
|00003b20| 65 64 4c 6f 6e 67 54 79 | 70 65 3a 0d 09 09 09 2a |edLongTy|pe:....*|
|00003b30| 28 75 6e 73 69 67 6e 65 | 64 20 6c 6f 6e 67 20 2a |(unsigne|d long *|
|00003b40| 29 76 2d 3e 70 74 72 3d | 73 74 72 74 6f 75 6c 4e |)v->ptr=|strtoulN|
|00003b50| 28 73 2c 26 73 2c 30 29 | 3b 0d 09 09 09 69 66 28 |(s,&s,0)|;....if(|
|00003b60| 45 43 48 4f 5f 41 53 53 | 49 47 4e 4d 45 4e 54 53 |ECHO_ASS|IGNMENTS|
|00003b70| 29 70 72 69 6e 74 66 28 | 22 25 6c 75 22 2c 2a 28 |)printf(|"%lu",*(|
|00003b80| 75 6e 73 69 67 6e 65 64 | 20 6c 6f 6e 67 20 2a 29 |unsigned| long *)|
|00003b90| 76 2d 3e 70 74 72 29 3b | 0d 09 09 09 62 72 65 61 |v->ptr);|....brea|
|00003ba0| 6b 3b 0d 09 09 63 61 73 | 65 20 64 6f 75 62 6c 65 |k;...cas|e double|
|00003bb0| 54 79 70 65 3a 0d 09 09 | 09 2a 28 64 6f 75 62 6c |Type:...|.*(doubl|
|00003bc0| 65 20 2a 29 76 2d 3e 70 | 74 72 3d 73 74 72 74 6f |e *)v->p|tr=strto|
|00003bd0| 64 4e 28 73 2c 26 73 29 | 3b 0d 09 09 09 69 66 28 |dN(s,&s)|;....if(|
|00003be0| 45 43 48 4f 5f 41 53 53 | 49 47 4e 4d 45 4e 54 53 |ECHO_ASS|IGNMENTS|
|00003bf0| 29 70 72 69 6e 74 66 28 | 22 25 67 22 2c 2a 28 64 |)printf(|"%g",*(d|
|00003c00| 6f 75 62 6c 65 20 2a 29 | 76 2d 3e 70 74 72 29 3b |ouble *)|v->ptr);|
|00003c10| 0d 09 09 09 62 72 65 61 | 6b 3b 0d 09 09 63 61 73 |....brea|k;...cas|
|00003c20| 65 20 73 74 72 69 6e 67 | 54 79 70 65 3a 0d 09 09 |e string|Type:...|
|00003c30| 09 2f 2a 20 70 61 72 73 | 65 20 74 68 65 20 6f 70 |./* pars|e the op|
|00003c40| 65 6e 69 6e 67 20 71 75 | 6f 74 65 20 6d 61 72 6b |ening qu|ote mark|
|00003c50| 20 2a 2f 0d 09 09 09 69 | 66 28 73 5b 30 5d 21 3d | */....i|f(s[0]!=|
|00003c60| 27 22 27 29 50 61 72 73 | 69 6e 67 45 72 72 6f 72 |'"')Pars|ingError|
|00003c70| 28 73 29 3b 0d 09 09 09 | 73 2b 2b 3b 0d 09 09 09 |(s);....|s++;....|
|00003c80| 73 32 3d 73 74 72 69 6e | 67 42 75 66 66 65 72 3b |s2=strin|gBuffer;|
|00003c90| 0d 09 09 09 64 6f 7b 0d | 09 09 09 09 2f 2a 20 63 |....do{.|..../* c|
|00003ca0| 6f 70 79 20 73 74 72 69 | 6e 67 20 62 75 74 20 74 |opy stri|ng but t|
|00003cb0| 72 61 6e 73 6c 61 74 65 | 20 62 61 63 6b 73 6c 61 |ranslate| backsla|
|00003cc0| 73 68 20 65 73 63 61 70 | 65 20 73 65 71 75 65 6e |sh escap|e sequen|
|00003cd0| 63 65 73 20 2a 2f 0d 09 | 09 09 09 64 6f 7b 0d 09 |ces */..|...do{..|
|00003ce0| 09 09 09 09 6a 3d 73 74 | 72 63 73 70 6e 28 73 2c |....j=st|rcspn(s,|
|00003cf0| 22 5c 5c 5c 22 22 29 3b | 0d 09 09 09 09 09 73 74 |"\\\"");|......st|
|00003d00| 72 6e 63 70 79 28 73 32 | 2c 73 2c 6a 29 3b 0d 09 |rncpy(s2|,s,j);..|
|00003d10| 09 09 09 09 73 2b 3d 6a | 3b 0d 09 09 09 09 09 73 |....s+=j|;......s|
|00003d20| 32 2b 3d 6a 3b 0d 09 09 | 09 09 09 73 32 5b 30 5d |2+=j;...|...s2[0]|
|00003d30| 3d 30 3b 0d 09 09 09 09 | 09 69 66 28 73 5b 30 5d |=0;.....|.if(s[0]|
|00003d40| 3d 3d 27 5c 5c 27 29 7b | 0d 09 09 09 09 09 09 73 |=='\\'){|.......s|
|00003d50| 32 2b 2b 5b 30 5d 3d 73 | 74 72 74 6f 63 28 73 2c |2++[0]=s|trtoc(s,|
|00003d60| 26 73 29 3b 0d 09 09 09 | 09 09 09 73 32 5b 30 5d |&s);....|...s2[0]|
|00003d70| 3d 30 3b 0d 09 09 09 09 | 09 7d 0d 09 09 09 09 09 |=0;.....|.}......|
|00003d80| 65 6c 73 65 20 62 72 65 | 61 6b 3b 0d 09 09 09 09 |else bre|ak;.....|
|00003d90| 7d 20 77 68 69 6c 65 20 | 28 31 29 3b 0d 09 09 09 |} while |(1);....|
|00003da0| 09 0d 09 09 09 09 2f 2a | 20 70 61 72 73 65 20 74 |....../*| parse t|
|00003db0| 68 65 20 63 6c 6f 73 69 | 6e 67 20 71 75 6f 74 65 |he closi|ng quote|
|00003dc0| 20 6d 61 72 6b 20 2a 2f | 0d 09 09 09 09 69 66 28 | mark */|.....if(|
|00003dd0| 73 5b 30 5d 21 3d 27 22 | 27 29 50 61 72 73 69 6e |s[0]!='"|')Parsin|
|00003de0| 67 45 72 72 6f 72 28 73 | 29 3b 0d 09 09 09 09 73 |gError(s|);.....s|
|00003df0| 2b 2b 3b 0d 09 09 09 09 | 0d 09 09 09 09 2f 2a 20 |++;.....|...../* |
|00003e00| 6c 6f 6f 6b 20 66 6f 72 | 20 61 6e 6f 74 68 65 72 |look for| another|
|00003e10| 20 6f 70 65 6e 69 6e 67 | 20 71 75 6f 74 65 20 6d | opening| quote m|
|00003e20| 61 72 6b 2e 20 43 6f 6e | 63 61 74 65 6e 61 74 65 |ark. Con|catenate|
|00003e30| 20 61 64 6a 61 63 65 6e | 74 20 73 74 72 69 6e 67 | adjacen|t string|
|00003e40| 73 20 2a 2f 0d 09 09 09 | 09 73 3d 47 65 74 54 6f |s */....|.s=GetTo|
|00003e50| 6b 65 6e 28 66 69 6c 65 | 2c 6c 69 6e 65 42 75 66 |ken(file|,lineBuf|
|00003e60| 66 65 72 2c 73 2c 65 63 | 68 6f 29 3b 0d 09 09 09 |fer,s,ec|ho);....|
|00003e70| 09 69 66 28 73 3d 3d 4e | 55 4c 4c 29 50 61 72 73 |.if(s==N|ULL)Pars|
|00003e80| 69 6e 67 45 72 72 6f 72 | 28 73 29 3b 0d 09 09 09 |ingError|(s);....|
|00003e90| 09 69 66 28 73 5b 30 5d | 21 3d 27 22 27 29 62 72 |.if(s[0]|!='"')br|
|00003ea0| 65 61 6b 3b 0d 09 09 09 | 09 73 2b 2b 3b 0d 09 09 |eak;....|.s++;...|
|00003eb0| 09 7d 77 68 69 6c 65 28 | 31 29 3b 0d 09 09 09 2f |.}while(|1);..../|
|00003ec0| 2a 20 61 6c 6c 6f 63 61 | 74 65 20 74 68 65 20 6e |* alloca|te the n|
|00003ed0| 65 77 20 73 74 72 69 6e | 67 20 2a 2f 0d 09 09 09 |ew strin|g */....|
|00003ee0| 2a 28 63 68 61 72 20 2a | 2a 29 76 2d 3e 70 74 72 |*(char *|*)v->ptr|
|00003ef0| 3d 6d 61 6c 6c 6f 63 28 | 31 2b 73 74 72 6c 65 6e |=malloc(|1+strlen|
|00003f00| 28 73 74 72 69 6e 67 42 | 75 66 66 65 72 29 29 3b |(stringB|uffer));|
|00003f10| 0d 09 09 09 69 66 28 76 | 2d 3e 70 74 72 3d 3d 4e |....if(v|->ptr==N|
|00003f20| 55 4c 4c 29 7b 0d 09 09 | 09 09 50 72 69 6e 74 66 |ULL){...|..Printf|
|00003f30| 45 78 69 74 28 22 5c 6e | 52 65 61 64 41 73 73 69 |Exit("\n|ReadAssi|
|00003f40| 67 6e 6d 65 6e 74 4c 69 | 6e 65 3a 20 63 6f 75 6c |gnmentLi|ne: coul|
|00003f50| 64 6e 27 74 20 61 6c 6c | 6f 63 61 74 65 20 25 6c |dn't all|ocate %l|
|00003f60| 64 20 62 79 74 65 73 20 | 66 6f 72 20 73 74 72 69 |d bytes |for stri|
|00003f70| 6e 67 2e 5c 30 30 37 5c | 6e 22 2c 31 4c 2b 73 74 |ng.\007\|n",1L+st|
|00003f80| 72 6c 65 6e 28 73 74 72 | 69 6e 67 42 75 66 66 65 |rlen(str|ingBuffe|
|00003f90| 72 29 29 3b 0d 09 09 09 | 7d 0d 09 09 09 73 74 72 |r));....|}....str|
|00003fa0| 63 70 79 28 2a 28 63 68 | 61 72 20 2a 2a 29 76 2d |cpy(*(ch|ar **)v-|
|00003fb0| 3e 70 74 72 2c 73 74 72 | 69 6e 67 42 75 66 66 65 |>ptr,str|ingBuffe|
|00003fc0| 72 29 3b 0d 09 09 09 69 | 66 28 45 43 48 4f 5f 41 |r);....i|f(ECHO_A|
|00003fd0| 53 53 49 47 4e 4d 45 4e | 54 53 29 70 72 69 6e 74 |SSIGNMEN|TS)print|
|00003fe0| 66 28 22 5c 22 25 73 5c | 22 22 2c 2a 28 63 68 61 |f("\"%s\|"",*(cha|
|00003ff0| 72 20 2a 2a 29 76 2d 3e | 70 74 72 29 3b 0d 09 09 |r **)v->|ptr);...|
|00004000| 09 62 72 65 61 6b 3b 0d | 09 09 7d 0d 0d 09 09 2f |.break;.|..}..../|
|00004010| 2a 20 70 61 72 73 65 20 | 74 68 65 20 73 65 6d 69 |* parse |the semi|
|00004020| 63 6f 6c 6f 6e 20 2a 2f | 0d 09 09 73 3d 47 65 74 |colon */|...s=Get|
|00004030| 54 6f 6b 65 6e 28 66 69 | 6c 65 2c 6c 69 6e 65 42 |Token(fi|le,lineB|
|00004040| 75 66 66 65 72 2c 73 2c | 65 63 68 6f 29 3b 0d 09 |uffer,s,|echo);..|
|00004050| 09 69 66 28 73 3d 3d 4e | 55 4c 4c 29 50 61 72 73 |.if(s==N|ULL)Pars|
|00004060| 69 6e 67 45 72 72 6f 72 | 28 73 29 3b 0d 09 09 69 |ingError|(s);...i|
|00004070| 66 28 73 5b 30 5d 21 3d | 27 3b 27 29 50 61 72 73 |f(s[0]!=|';')Pars|
|00004080| 69 6e 67 45 72 72 6f 72 | 28 73 29 3b 0d 09 09 73 |ingError|(s);...s|
|00004090| 2b 2b 3b 0d 09 09 69 66 | 28 45 43 48 4f 5f 41 53 |++;...if|(ECHO_AS|
|000040a0| 53 49 47 4e 4d 45 4e 54 | 53 29 70 72 69 6e 74 66 |SIGNMENT|S)printf|
|000040b0| 28 22 3b 09 22 29 3b 0d | 09 09 0d 09 09 6e 2b 2b |(";.");.|.....n++|
|000040c0| 3b 0d 09 7d 20 77 68 69 | 6c 65 28 31 29 3b 0d 7d |;..} whi|le(1);.}|
|000040d0| 0d 0d 76 6f 69 64 20 50 | 61 72 73 69 6e 67 45 72 |..void P|arsingEr|
|000040e0| 72 6f 72 28 63 68 61 72 | 20 2a 73 29 0d 7b 0d 09 |ror(char| *s).{..|
|000040f0| 69 6e 74 20 69 3b 0d 09 | 0d 09 69 66 28 73 3d 3d |int i;..|..if(s==|
|00004100| 4e 55 4c 4c 29 50 72 69 | 6e 74 66 45 78 69 74 28 |NULL)Pri|ntfExit(|
|00004110| 22 5c 6e 52 65 61 64 41 | 73 73 69 67 6e 6d 65 6e |"\nReadA|ssignmen|
|00004120| 74 4c 69 6e 65 3a 20 70 | 72 65 6d 61 74 75 72 65 |tLine: p|remature|
|00004130| 20 65 6e 64 20 6f 66 20 | 66 69 6c 65 2e 5c 30 30 | end of |file.\00|
|00004140| 37 5c 6e 22 29 3b 0d 09 | 70 72 69 6e 74 66 28 22 |7\n");..|printf("|
|00004150| 5c 6e 52 65 61 64 41 73 | 73 69 67 6e 6d 65 6e 74 |\nReadAs|signment|
|00004160| 4c 69 6e 65 3a 20 65 72 | 72 6f 72 20 6c 6f 63 61 |Line: er|ror loca|
|00004170| 74 69 6f 6e 20 69 6e 64 | 69 63 61 74 65 64 20 62 |tion ind|icated b|
|00004180| 79 20 74 68 65 20 63 61 | 72 65 74 20 5e 2e 5c 30 |y the ca|ret ^.\0|
|00004190| 30 37 5c 6e 22 29 3b 0d | 09 70 72 69 6e 74 66 28 |07\n");.|.printf(|
|000041a0| 22 25 73 22 2c 6c 69 6e | 65 42 75 66 66 65 72 29 |"%s",lin|eBuffer)|
|000041b0| 3b 0d 09 73 5b 30 5d 3d | 27 5e 27 3b 0d 09 73 5b |;..s[0]=|'^';..s[|
|000041c0| 31 5d 3d 30 3b 0d 09 73 | 3d 6c 69 6e 65 42 75 66 |1]=0;..s|=lineBuf|
|000041d0| 66 65 72 3b 0d 09 66 6f | 72 28 69 3d 30 3b 69 3c |fer;..fo|r(i=0;i<|
|000041e0| 73 74 72 6c 65 6e 28 73 | 29 2d 31 3b 69 2b 2b 29 |strlen(s|)-1;i++)|
|000041f0| 69 66 28 69 73 70 72 69 | 6e 74 28 73 5b 69 5d 29 |if(ispri|nt(s[i])|
|00004200| 29 73 5b 69 5d 3d 27 20 | 27 3b 0d 09 50 72 69 6e |)s[i]=' |';..Prin|
|00004210| 74 66 45 78 69 74 28 22 | 25 73 5c 6e 22 2c 6c 69 |tfExit("|%s\n",li|
|00004220| 6e 65 42 75 66 66 65 72 | 29 3b 0d 7d 0d 0d 2f 2a |neBuffer|);.}../*|
|00004230| 0d 53 6b 69 70 20 70 61 | 73 74 20 77 68 69 74 65 |.Skip pa|st white|
|00004240| 20 73 70 61 63 65 20 61 | 6e 64 20 63 6f 6d 6d 65 | space a|nd comme|
|00004250| 6e 74 73 20 74 6f 20 74 | 68 65 20 62 65 67 69 6e |nts to t|he begin|
|00004260| 6e 69 6e 67 20 6f 66 20 | 74 68 65 20 6e 65 78 74 |ning of |the next|
|00004270| 20 74 6f 6b 65 6e 2c 0d | 72 65 61 64 69 6e 67 20 | token,.|reading |
|00004280| 61 73 20 6d 61 6e 79 20 | 6c 69 6e 65 73 20 61 73 |as many |lines as|
|00004290| 20 6e 65 63 65 73 73 61 | 72 79 2e 0d 2a 2f 0d 63 | necessa|ry..*/.c|
|000042a0| 68 61 72 20 2a 47 65 74 | 54 6f 6b 65 6e 28 46 49 |har *Get|Token(FI|
|000042b0| 4c 45 20 2a 66 69 6c 65 | 2c 63 68 61 72 20 2a 6c |LE *file|,char *l|
|000042c0| 69 6e 65 42 75 66 66 65 | 72 2c 63 68 61 72 20 2a |ineBuffe|r,char *|
|000042d0| 73 2c 69 6e 74 20 65 63 | 68 6f 29 0d 7b 0d 09 64 |s,int ec|ho).{..d|
|000042e0| 6f 7b 0d 09 09 73 3d 47 | 65 74 54 6f 6b 65 6e 31 |o{...s=G|etToken1|
|000042f0| 28 66 69 6c 65 2c 6c 69 | 6e 65 42 75 66 66 65 72 |(file,li|neBuffer|
|00004300| 2c 73 2c 65 63 68 6f 29 | 3b 0d 09 09 69 66 28 73 |,s,echo)|;...if(s|
|00004310| 21 3d 4e 55 4c 4c 20 7c | 7c 20 66 65 6f 66 28 66 |!=NULL ||| feof(f|
|00004320| 69 6c 65 29 29 72 65 74 | 75 72 6e 20 73 3b 0d 09 |ile))ret|urn s;..|
|00004330| 7d 77 68 69 6c 65 28 31 | 29 3b 0d 7d 0d 0d 2f 2a |}while(1|);.}../*|
|00004340| 0d 53 6b 69 70 20 70 61 | 73 74 20 77 68 69 74 65 |.Skip pa|st white|
|00004350| 20 73 70 61 63 65 20 61 | 6e 64 20 63 6f 6d 6d 65 | space a|nd comme|
|00004360| 6e 74 73 20 74 6f 20 74 | 68 65 20 62 65 67 69 6e |nts to t|he begin|
|00004370| 6e 69 6e 67 20 6f 66 20 | 74 68 65 20 6e 65 78 74 |ning of |the next|
|00004380| 20 74 6f 6b 65 6e 2c 0d | 72 65 61 64 69 6e 67 20 | token,.|reading |
|00004390| 6f 6e 65 20 6c 69 6e 65 | 20 69 66 20 6e 65 63 65 |one line| if nece|
|000043a0| 73 73 61 72 79 2e 20 54 | 68 65 20 6c 69 6e 65 57 |ssary. T|he lineW|
|000043b0| 61 73 42 6c 61 6e 6b 20 | 42 6f 6f 6c 65 61 6e 20 |asBlank |Boolean |
|000043c0| 67 6c 6f 62 61 6c 20 69 | 73 20 6f 6e 6c 79 20 75 |global i|s only u|
|000043d0| 73 65 64 0d 68 65 72 65 | 2c 20 52 65 61 64 41 73 |sed.here|, ReadAs|
|000043e0| 73 69 67 6e 6d 65 6e 74 | 4c 69 6e 65 28 29 2c 20 |signment|Line(), |
|000043f0| 61 6e 64 20 69 6e 20 41 | 73 73 69 67 6e 6d 65 6e |and in A|ssignmen|
|00004400| 74 4c 69 6e 65 57 61 73 | 42 6c 61 6e 6b 28 29 2e |tLineWas|Blank().|
|00004410| 0d 2a 2f 0d 63 68 61 72 | 20 2a 47 65 74 54 6f 6b |.*/.char| *GetTok|
|00004420| 65 6e 31 28 46 49 4c 45 | 20 2a 66 69 6c 65 2c 63 |en1(FILE| *file,c|
|00004430| 68 61 72 20 2a 6c 69 6e | 65 42 75 66 66 65 72 2c |har *lin|eBuffer,|
|00004440| 63 68 61 72 20 2a 73 2c | 69 6e 74 20 65 63 68 6f |char *s,|int echo|
|00004450| 29 0d 7b 0d 09 73 74 61 | 74 69 63 20 63 68 61 72 |).{..sta|tic char|
|00004460| 20 77 68 69 74 65 53 70 | 61 63 65 5b 5d 3d 22 20 | whiteSp|ace[]=" |
|00004470| 5c 74 5c 6e 5c 72 5c 76 | 5c 66 22 3b 0d 09 65 78 |\t\n\r\v|\f";..ex|
|00004480| 74 65 72 6e 20 42 6f 6f | 6c 65 61 6e 20 6c 69 6e |tern Boo|lean lin|
|00004490| 65 57 61 73 42 6c 61 6e | 6b 3b 0d 0d 09 73 3d 47 |eWasBlan|k;...s=G|
|000044a0| 65 74 54 6f 6b 65 6e 30 | 28 66 69 6c 65 2c 6c 69 |etToken0|(file,li|
|000044b0| 6e 65 42 75 66 66 65 72 | 2c 73 2c 65 63 68 6f 29 |neBuffer|,s,echo)|
|000044c0| 3b 0d 09 69 66 28 73 21 | 3d 4e 55 4c 4c 29 72 65 |;..if(s!|=NULL)re|
|000044d0| 74 75 72 6e 20 73 3b 0d | 09 73 3d 66 67 65 74 73 |turn s;.|.s=fgets|
|000044e0| 28 6c 69 6e 65 42 75 66 | 66 65 72 2c 42 55 46 46 |(lineBuf|fer,BUFF|
|000044f0| 45 52 5f 53 49 5a 45 2c | 66 69 6c 65 29 3b 0d 09 |ER_SIZE,|file);..|
|00004500| 69 66 28 73 3d 3d 4e 55 | 4c 4c 29 72 65 74 75 72 |if(s==NU|LL)retur|
|00004510| 6e 20 4e 55 4c 4c 3b 0d | 09 69 66 28 45 43 48 4f |n NULL;.|.if(ECHO|
|00004520| 5f 46 49 4c 45 29 70 72 | 69 6e 74 66 28 22 25 73 |_FILE)pr|intf("%s|
|00004530| 22 2c 73 29 3b 0d 09 69 | 66 28 73 74 72 6c 65 6e |",s);..i|f(strlen|
|00004540| 28 73 29 21 3d 73 74 72 | 73 70 6e 28 73 2c 77 68 |(s)!=str|spn(s,wh|
|00004550| 69 74 65 53 70 61 63 65 | 29 29 6c 69 6e 65 57 61 |iteSpace|))lineWa|
|00004560| 73 42 6c 61 6e 6b 3d 46 | 41 4c 53 45 3b 0d 09 73 |sBlank=F|ALSE;..s|
|00004570| 3d 47 65 74 54 6f 6b 65 | 6e 30 28 66 69 6c 65 2c |=GetToke|n0(file,|
|00004580| 6c 69 6e 65 42 75 66 66 | 65 72 2c 73 2c 65 63 68 |lineBuff|er,s,ech|
|00004590| 6f 29 3b 0d 09 72 65 74 | 75 72 6e 20 73 3b 0d 7d |o);..ret|urn s;.}|
|000045a0| 0d 0d 2f 2a 0d 53 6b 69 | 70 20 70 61 73 74 20 77 |../*.Ski|p past w|
|000045b0| 68 69 74 65 20 73 70 61 | 63 65 20 61 6e 64 20 63 |hite spa|ce and c|
|000045c0| 6f 6d 6d 65 6e 74 73 20 | 74 6f 20 74 68 65 20 62 |omments |to the b|
|000045d0| 65 67 69 6e 6e 69 6e 67 | 20 6f 66 20 74 68 65 20 |eginning| of the |
|000045e0| 6e 65 78 74 20 74 6f 6b | 65 6e 2e 0d 47 65 74 54 |next tok|en..GetT|
|000045f0| 6f 6b 65 6e 30 20 77 69 | 6c 6c 20 72 65 61 64 20 |oken0 wi|ll read |
|00004600| 69 6e 20 6e 65 77 20 6c | 69 6e 65 73 20 6f 6e 6c |in new l|ines onl|
|00004610| 79 20 69 66 20 6e 65 65 | 64 65 64 20 74 6f 20 66 |y if nee|ded to f|
|00004620| 69 6e 64 20 74 68 65 20 | 65 6e 64 20 6f 66 20 61 |ind the |end of a|
|00004630| 6e 0d 75 6e 66 69 6e 69 | 73 68 65 64 20 63 6f 6d |n.unfini|shed com|
|00004640| 6d 65 6e 74 2e 20 49 6e | 70 75 74 20 66 72 6f 6d |ment. In|put from|
|00004650| 20 66 69 6c 65 20 69 73 | 20 62 75 66 66 65 72 65 | file is| buffere|
|00004660| 64 20 6f 6e 65 20 6c 69 | 6e 65 20 61 74 20 61 20 |d one li|ne at a |
|00004670| 74 69 6d 65 20 69 6e 20 | 6c 69 6e 65 42 75 66 66 |time in |lineBuff|
|00004680| 65 72 2c 0d 61 6e 64 20 | 73 20 70 6f 69 6e 74 73 |er,.and |s points|
|00004690| 20 74 6f 20 74 68 65 20 | 6e 65 78 74 20 75 6e 70 | to the |next unp|
|000046a0| 61 72 73 65 64 20 63 68 | 61 72 61 63 74 65 72 20 |arsed ch|aracter |
|000046b0| 69 6e 20 74 68 61 74 20 | 62 75 66 66 65 72 2e 0d |in that |buffer..|
|000046c0| 2a 2f 0d 63 68 61 72 20 | 2a 47 65 74 54 6f 6b 65 |*/.char |*GetToke|
|000046d0| 6e 30 28 46 49 4c 45 20 | 2a 66 69 6c 65 2c 63 68 |n0(FILE |*file,ch|
|000046e0| 61 72 20 2a 6c 69 6e 65 | 42 75 66 66 65 72 2c 63 |ar *line|Buffer,c|
|000046f0| 68 61 72 20 2a 73 2c 69 | 6e 74 20 65 63 68 6f 29 |har *s,i|nt echo)|
|00004700| 0d 7b 0d 09 73 74 61 74 | 69 63 20 63 68 61 72 20 |.{..stat|ic char |
|00004710| 77 68 69 74 65 53 70 61 | 63 65 5b 5d 3d 22 20 5c |whiteSpa|ce[]=" \|
|00004720| 74 5c 6e 5c 72 5c 76 5c | 66 22 3b 0d 09 63 68 61 |t\n\r\v\|f";..cha|
|00004730| 72 20 2a 73 54 65 6d 70 | 3b 0d 0d 09 69 66 28 73 |r *sTemp|;...if(s|
|00004740| 3d 3d 4e 55 4c 4c 29 67 | 6f 74 6f 20 65 6e 64 4f |==NULL)g|oto endO|
|00004750| 66 4c 69 6e 65 3b 0d 09 | 64 6f 7b 0d 09 09 2f 2a |fLine;..|do{.../*|
|00004760| 20 73 6b 69 70 20 77 68 | 69 74 65 20 73 70 61 63 | skip wh|ite spac|
|00004770| 65 20 61 6e 64 20 63 6f | 6d 6d 65 6e 74 73 20 2a |e and co|mments *|
|00004780| 2f 0d 09 09 64 6f 20 7b | 0d 09 09 09 69 66 28 73 |/...do {|....if(s|
|00004790| 74 72 6c 65 6e 28 73 29 | 3d 3d 30 29 67 6f 74 6f |trlen(s)|==0)goto|
|000047a0| 20 65 6e 64 4f 66 4c 69 | 6e 65 3b 0d 09 09 09 73 | endOfLi|ne;....s|
|000047b0| 2b 3d 73 74 72 73 70 6e | 28 73 2c 77 68 69 74 65 |+=strspn|(s,white|
|000047c0| 53 70 61 63 65 29 3b 0d | 09 09 09 69 66 28 73 74 |Space);.|...if(st|
|000047d0| 72 6c 65 6e 28 73 29 3d | 3d 30 29 67 6f 74 6f 20 |rlen(s)=|=0)goto |
|000047e0| 65 6e 64 4f 66 4c 69 6e | 65 3b 0d 09 09 09 69 66 |endOfLin|e;....if|
|000047f0| 28 73 74 72 65 71 32 28 | 73 2c 22 2f 5c 2a 22 29 |(streq2(|s,"/\*")|
|00004800| 29 7b 0d 09 09 09 09 64 | 6f 7b 0d 09 09 09 09 09 |){.....d|o{......|
|00004810| 73 54 65 6d 70 3d 73 3b | 0d 09 09 09 09 09 73 3d |sTemp=s;|......s=|
|00004820| 73 74 72 73 74 72 28 73 | 2c 22 2a 5c 2f 22 29 3b |strstr(s|,"*\/");|
|00004830| 0d 09 09 09 09 09 69 66 | 28 73 21 3d 4e 55 4c 4c |......if|(s!=NULL|
|00004840| 29 62 72 65 61 6b 3b 0d | 09 09 09 09 09 69 66 28 |)break;.|.....if(|
|00004850| 45 43 48 4f 5f 43 4f 4d | 4d 45 4e 54 53 29 70 72 |ECHO_COM|MENTS)pr|
|00004860| 69 6e 74 66 28 22 25 73 | 22 2c 73 54 65 6d 70 29 |intf("%s|",sTemp)|
|00004870| 3b 0d 09 09 09 09 09 73 | 3d 66 67 65 74 73 28 6c |;......s|=fgets(l|
|00004880| 69 6e 65 42 75 66 66 65 | 72 2c 42 55 46 46 45 52 |ineBuffe|r,BUFFER|
|00004890| 5f 53 49 5a 45 2c 66 69 | 6c 65 29 3b 0d 09 09 09 |_SIZE,fi|le);....|
|000048a0| 09 09 69 66 28 73 3d 3d | 4e 55 4c 4c 29 50 61 72 |..if(s==|NULL)Par|
|000048b0| 73 69 6e 67 45 72 72 6f | 72 28 73 29 3b 0d 09 09 |singErro|r(s);...|
|000048c0| 09 09 09 69 66 28 45 43 | 48 4f 5f 46 49 4c 45 29 |...if(EC|HO_FILE)|
|000048d0| 70 72 69 6e 74 66 28 22 | 25 73 22 2c 73 29 3b 0d |printf("|%s",s);.|
|000048e0| 09 09 09 09 7d 20 77 68 | 69 6c 65 28 31 29 3b 0d |....} wh|ile(1);.|
|000048f0| 09 09 09 09 73 2b 3d 32 | 3b 0d 09 09 09 09 69 66 |....s+=2|;.....if|
|00004900| 28 45 43 48 4f 5f 43 4f | 4d 4d 45 4e 54 53 29 7b |(ECHO_CO|MMENTS){|
|00004910| 0d 09 09 09 09 09 73 5b | 2d 31 5d 3d 30 3b 0d 09 |......s[|-1]=0;..|
|00004920| 09 09 09 09 70 72 69 6e | 74 66 28 22 25 73 2f 22 |....prin|tf("%s/"|
|00004930| 2c 73 54 65 6d 70 29 3b | 0d 09 09 09 09 7d 0d 09 |,sTemp);|.....}..|
|00004940| 09 09 09 63 6f 6e 74 69 | 6e 75 65 3b 0d 09 09 09 |...conti|nue;....|
|00004950| 7d 0d 09 09 09 69 66 28 | 73 74 72 65 71 32 28 73 |}....if(|streq2(s|
|00004960| 2c 22 2f 5c 2f 22 29 29 | 7b 0d 09 09 09 09 69 66 |,"/\/"))|{.....if|
|00004970| 28 45 43 48 4f 5f 43 4f | 4d 4d 45 4e 54 53 29 7b |(ECHO_CO|MMENTS){|
|00004980| 0d 09 09 09 09 09 69 66 | 28 73 5b 73 74 72 6c 65 |......if|(s[strle|
|00004990| 6e 28 73 29 2d 31 5d 3d | 3d 27 5c 6e 27 29 73 5b |n(s)-1]=|='\n')s[|
|000049a0| 73 74 72 6c 65 6e 28 73 | 29 2d 31 5d 3d 30 3b 0d |strlen(s|)-1]=0;.|
|000049b0| 09 09 09 09 09 70 72 69 | 6e 74 66 28 22 09 25 73 |.....pri|ntf(".%s|
|000049c0| 22 2c 73 29 3b 0d 09 09 | 09 09 7d 0d 09 09 09 09 |",s);...|..}.....|
|000049d0| 67 6f 74 6f 20 65 6e 64 | 4f 66 4c 69 6e 65 3b 0d |goto end|OfLine;.|
|000049e0| 09 09 09 7d 0d 09 09 09 | 62 72 65 61 6b 3b 0d 09 |...}....|break;..|
|000049f0| 09 7d 20 77 68 69 6c 65 | 28 31 29 3b 0d 09 09 72 |.} while|(1);...r|
|00004a00| 65 74 75 72 6e 20 73 3b | 09 2f 2a 20 6e 6f 72 6d |eturn s;|./* norm|
|00004a10| 61 6c 20 72 65 74 75 72 | 6e 20 2a 2f 0d 09 7d 77 |al retur|n */..}w|
|00004a20| 68 69 6c 65 28 31 29 3b | 0d 65 6e 64 4f 66 4c 69 |hile(1);|.endOfLi|
|00004a30| 6e 65 3a 0d 09 69 66 28 | 28 45 43 48 4f 5f 41 53 |ne:..if(|(ECHO_AS|
|00004a40| 53 49 47 4e 4d 45 4e 54 | 53 20 7c 7c 20 45 43 48 |SIGNMENT|S || ECH|
|00004a50| 4f 5f 43 4f 4d 4d 45 4e | 54 53 29 20 26 26 20 73 |O_COMMEN|TS) && s|
|00004a60| 21 3d 4e 55 4c 4c 29 70 | 72 69 6e 74 66 28 22 5c |!=NULL)p|rintf("\|
|00004a70| 6e 22 29 3b 0d 09 72 65 | 74 75 72 6e 20 4e 55 4c |n");..re|turn NUL|
|00004a80| 4c 3b 0d 7d 0d 0d 64 6f | 75 62 6c 65 20 73 74 72 |L;.}..do|uble str|
|00004a90| 74 6f 64 4e 28 63 68 61 | 72 20 2a 73 2c 63 68 61 |todN(cha|r *s,cha|
|00004aa0| 72 20 2a 2a 73 50 74 72 | 29 0d 2f 2a 20 53 75 70 |r **sPtr|)./* Sup|
|00004ab0| 70 6c 65 6d 65 6e 74 20 | 73 74 61 6e 64 61 72 64 |plement |standard|
|00004ac0| 20 43 20 72 6f 75 74 69 | 6e 65 20 73 74 72 74 6f | C routi|ne strto|
|00004ad0| 64 28 29 20 62 79 20 68 | 61 6e 64 6c 69 6e 67 20 |d() by h|andling |
|00004ae0| 4e 41 4e 20 61 6e 64 20 | 49 4e 46 20 2a 2f 0d 2f |NAN and |INF */./|
|00004af0| 2a 20 54 68 65 20 4e 41 | 4e 20 74 79 70 65 2c 20 |* The NA|N type, |
|00004b00| 69 66 20 61 6e 79 2c 20 | 69 73 20 73 6b 69 70 70 |if any, |is skipp|
|00004b10| 65 64 2c 20 77 68 65 74 | 68 65 72 20 69 6e 20 54 |ed, whet|her in T|
|00004b20| 48 49 4e 4b 20 43 20 73 | 74 79 6c 65 2c 20 65 2e |HINK C s|tyle, e.|
|00004b30| 67 2e 20 4e 41 4e 46 46 | 2c 20 6f 72 20 69 6e 0d |g. NANFF|, or in.|
|00004b40| 4d 50 57 20 43 20 73 74 | 79 6c 65 2c 20 65 2e 67 |MPW C st|yle, e.g|
|00004b50| 2e 20 4e 61 6e 5b 32 35 | 35 5d 2e 20 2a 2f 0d 7b |. Nan[25|5]. */.{|
|00004b60| 0d 09 69 66 28 73 74 72 | 65 71 32 28 73 2c 22 4e |..if(str|eq2(s,"N|
|00004b70| 41 4e 22 29 7c 7c 73 74 | 72 65 71 32 28 73 2c 22 |AN")||st|req2(s,"|
|00004b80| 4e 61 4e 22 29 7c 7c 73 | 74 72 65 71 32 28 73 2c |NaN")||s|treq2(s,|
|00004b90| 22 4e 61 6e 22 29 7c 7c | 73 74 72 65 71 32 28 73 |"Nan")|||streq2(s|
|00004ba0| 2c 22 6e 61 6e 22 29 29 | 7b 0d 09 09 73 2b 3d 33 |,"nan"))|{...s+=3|
|00004bb0| 3b 0d 09 09 73 2b 3d 73 | 74 72 73 70 6e 28 73 2c |;...s+=s|trspn(s,|
|00004bc0| 22 30 31 32 33 34 35 36 | 37 38 39 61 62 63 64 65 |"0123456|789abcde|
|00004bd0| 66 41 42 43 44 45 46 5b | 5d 22 29 3b 0d 09 09 2a |fABCDEF[|]");...*|
|00004be0| 73 50 74 72 3d 73 3b 0d | 09 09 72 65 74 75 72 6e |sPtr=s;.|..return|
|00004bf0| 20 4e 41 4e 3b 0d 09 7d | 0d 09 69 66 28 73 74 72 | NAN;..}|..if(str|
|00004c00| 6e 63 6d 70 28 73 2c 22 | 49 4e 46 22 2c 33 29 3d |ncmp(s,"|INF",3)=|
|00004c10| 3d 30 7c 7c 73 74 72 6e | 63 6d 70 28 73 2c 22 49 |=0||strn|cmp(s,"I|
|00004c20| 6e 66 22 2c 33 29 3d 3d | 30 7c 7c 73 74 72 6e 63 |nf",3)==|0||strnc|
|00004c30| 6d 70 28 73 2c 22 69 6e | 66 22 2c 33 29 3d 3d 30 |mp(s,"in|f",3)==0|
|00004c40| 29 7b 0d 09 09 73 2b 3d | 33 3b 0d 09 09 2a 73 50 |){...s+=|3;...*sP|
|00004c50| 74 72 3d 73 3b 0d 09 09 | 72 65 74 75 72 6e 20 49 |tr=s;...|return I|
|00004c60| 4e 46 3b 0d 09 7d 0d 09 | 69 66 28 73 74 72 6e 63 |NF;..}..|if(strnc|
|00004c70| 6d 70 28 73 2c 22 2d 49 | 4e 46 22 2c 34 29 3d 3d |mp(s,"-I|NF",4)==|
|00004c80| 30 7c 7c 73 74 72 6e 63 | 6d 70 28 73 2c 22 2d 49 |0||strnc|mp(s,"-I|
|00004c90| 6e 66 22 2c 34 29 3d 3d | 30 7c 7c 73 74 72 6e 63 |nf",4)==|0||strnc|
|00004ca0| 6d 70 28 73 2c 22 2d 69 | 6e 66 22 2c 34 29 3d 3d |mp(s,"-i|nf",4)==|
|00004cb0| 30 29 7b 0d 09 09 73 2b | 3d 34 3b 0d 09 09 2a 73 |0){...s+|=4;...*s|
|00004cc0| 50 74 72 3d 73 3b 0d 09 | 09 72 65 74 75 72 6e 20 |Ptr=s;..|.return |
|00004cd0| 2d 49 4e 46 3b 0d 09 7d | 0d 09 72 65 74 75 72 6e |-INF;..}|..return|
|00004ce0| 20 73 74 72 74 6f 64 28 | 73 2c 73 50 74 72 29 3b | strtod(|s,sPtr);|
|00004cf0| 0d 7d 0d 0d 6c 6f 6e 67 | 20 73 74 72 74 6f 6c 4e |.}..long| strtolN|
|00004d00| 28 63 68 61 72 20 2a 73 | 2c 63 68 61 72 20 2a 2a |(char *s|,char **|
|00004d10| 73 50 74 72 2c 73 68 6f | 72 74 20 66 6c 61 67 29 |sPtr,sho|rt flag)|
|00004d20| 0d 2f 2a 20 53 75 70 70 | 6c 65 6d 65 6e 74 20 73 |./* Supp|lement s|
|00004d30| 74 61 6e 64 61 72 64 20 | 43 20 72 6f 75 74 69 6e |tandard |C routin|
|00004d40| 65 20 73 74 72 74 6f 6c | 28 29 20 62 79 20 68 61 |e strtol|() by ha|
|00004d50| 6e 64 6c 69 6e 67 20 71 | 75 6f 74 65 64 20 63 68 |ndling q|uoted ch|
|00004d60| 61 72 2c 20 65 2e 67 2e | 20 27 65 27 20 2a 2f 0d |ar, e.g.| 'e' */.|
|00004d70| 7b 0d 09 6c 6f 6e 67 20 | 6a 3b 0d 09 0d 09 69 66 |{..long |j;....if|
|00004d80| 28 73 5b 30 5d 21 3d 27 | 5c 27 27 29 20 72 65 74 |(s[0]!='|\'') ret|
|00004d90| 75 72 6e 20 73 74 72 74 | 6f 6c 28 73 2c 73 50 74 |urn strt|ol(s,sPt|
|00004da0| 72 2c 66 6c 61 67 29 3b | 0d 09 73 2b 2b 3b 0d 09 |r,flag);|..s++;..|
|00004db0| 6a 3d 73 74 72 74 6f 63 | 28 73 2c 26 73 29 3b 0d |j=strtoc|(s,&s);.|
|00004dc0| 09 69 66 28 73 5b 30 5d | 21 3d 27 5c 27 27 29 50 |.if(s[0]|!='\'')P|
|00004dd0| 61 72 73 69 6e 67 45 72 | 72 6f 72 28 73 29 3b 0d |arsingEr|ror(s);.|
|00004de0| 09 2a 73 50 74 72 3d 73 | 2b 31 3b 0d 09 72 65 74 |.*sPtr=s|+1;..ret|
|00004df0| 75 72 6e 20 6a 3b 0d 7d | 09 0d 0d 75 6e 73 69 67 |urn j;.}|...unsig|
|00004e00| 6e 65 64 20 6c 6f 6e 67 | 20 73 74 72 74 6f 75 6c |ned long| strtoul|
|00004e10| 4e 28 63 68 61 72 20 2a | 73 2c 63 68 61 72 20 2a |N(char *|s,char *|
|00004e20| 2a 73 50 74 72 2c 73 68 | 6f 72 74 20 66 6c 61 67 |*sPtr,sh|ort flag|
|00004e30| 29 0d 2f 2a 20 53 75 70 | 70 6c 65 6d 65 6e 74 20 |)./* Sup|plement |
|00004e40| 73 74 61 6e 64 61 72 64 | 20 43 20 72 6f 75 74 69 |standard| C routi|
|00004e50| 6e 65 20 62 79 20 68 61 | 6e 64 6c 69 6e 67 20 71 |ne by ha|ndling q|
|00004e60| 75 6f 74 65 64 20 63 68 | 61 72 2c 20 65 2e 67 2e |uoted ch|ar, e.g.|
|00004e70| 20 27 65 27 20 2a 2f 0d | 7b 0d 09 75 6e 73 69 67 | 'e' */.|{..unsig|
|00004e80| 6e 65 64 20 6c 6f 6e 67 | 20 6a 3b 0d 09 0d 09 69 |ned long| j;....i|
|00004e90| 66 28 73 5b 30 5d 21 3d | 27 5c 27 27 29 20 72 65 |f(s[0]!=|'\'') re|
|00004ea0| 74 75 72 6e 20 73 74 72 | 74 6f 75 6c 28 73 2c 73 |turn str|toul(s,s|
|00004eb0| 50 74 72 2c 66 6c 61 67 | 29 3b 0d 09 73 2b 2b 3b |Ptr,flag|);..s++;|
|00004ec0| 0d 09 6a 3d 73 74 72 74 | 6f 63 28 73 2c 26 73 29 |..j=strt|oc(s,&s)|
|00004ed0| 3b 0d 09 6a 20 26 3d 20 | 32 35 35 4c 3b 09 09 2f |;..j &= |255L;../|
|00004ee0| 2a 20 73 74 72 69 70 20 | 6f 66 66 20 61 6e 79 20 |* strip |off any |
|00004ef0| 73 69 67 6e 20 65 78 74 | 65 6e 73 69 6f 6e 2c 20 |sign ext|ension, |
|00004f00| 73 69 6e 63 65 20 63 68 | 61 72 20 77 61 73 20 73 |since ch|ar was s|
|00004f10| 69 67 6e 65 64 20 2a 2f | 0d 09 69 66 28 73 5b 30 |igned */|..if(s[0|
|00004f20| 5d 21 3d 27 5c 27 27 29 | 50 61 72 73 69 6e 67 45 |]!='\'')|ParsingE|
|00004f30| 72 72 6f 72 28 73 29 3b | 0d 09 2a 73 50 74 72 3d |rror(s);|..*sPtr=|
|00004f40| 73 2b 31 3b 0d 09 72 65 | 74 75 72 6e 20 6a 3b 0d |s+1;..re|turn j;.|
|00004f50| 7d 09 0d 0d 63 68 61 72 | 20 73 74 72 74 6f 63 28 |}...char| strtoc(|
|00004f60| 63 68 61 72 20 2a 73 2c | 63 68 61 72 20 2a 2a 73 |char *s,|char **s|
|00004f70| 50 74 72 29 0d 2f 2a 20 | 45 78 74 72 61 63 74 20 |Ptr)./* |Extract |
|00004f80| 61 20 63 68 61 72 61 63 | 74 65 72 20 66 72 6f 6d |a charac|ter from|
|00004f90| 20 61 20 73 74 72 69 6e | 67 2c 20 74 72 61 6e 73 | a strin|g, trans|
|00004fa0| 6c 61 74 69 6e 67 20 62 | 61 63 6b 73 6c 61 73 68 |lating b|ackslash|
|00004fb0| 20 65 73 63 61 70 65 73 | 20 2a 2f 0d 7b 0d 09 63 | escapes| */.{..c|
|00004fc0| 68 61 72 20 63 3b 0d 09 | 0d 09 69 66 28 73 5b 30 |har c;..|..if(s[0|
|00004fd0| 5d 21 3d 27 5c 5c 27 29 | 7b 0d 09 09 2a 73 50 74 |]!='\\')|{...*sPt|
|00004fe0| 72 3d 73 2b 31 3b 0d 09 | 09 69 66 28 73 5b 30 5d |r=s+1;..|.if(s[0]|
|00004ff0| 3d 3d 27 22 27 29 72 65 | 74 75 72 6e 20 30 3b 0d |=='"')re|turn 0;.|
|00005000| 09 09 65 6c 73 65 20 72 | 65 74 75 72 6e 20 73 5b |..else r|eturn s[|
|00005010| 30 5d 3b 0d 09 7d 0d 09 | 73 2b 2b 3b 0d 09 73 77 |0];..}..|s++;..sw|
|00005020| 69 74 63 68 28 73 2b 2b | 5b 30 5d 29 7b 0d 09 63 |itch(s++|[0]){..c|
|00005030| 61 73 65 20 27 6e 27 3a | 20 63 3d 27 5c 6e 27 3b |ase 'n':| c='\n';|
|00005040| 20 62 72 65 61 6b 3b 0d | 09 63 61 73 65 20 27 72 | break;.|.case 'r|
|00005050| 27 3a 20 63 3d 27 5c 72 | 27 3b 20 62 72 65 61 6b |': c='\r|'; break|
|00005060| 3b 0d 09 63 61 73 65 20 | 27 74 27 3a 20 63 3d 27 |;..case |'t': c='|
|00005070| 5c 74 27 3b 20 62 72 65 | 61 6b 3b 0d 09 63 61 73 |\t'; bre|ak;..cas|
|00005080| 65 20 27 62 27 3a 20 63 | 3d 27 5c 62 27 3b 20 62 |e 'b': c|='\b'; b|
|00005090| 72 65 61 6b 3b 0d 09 63 | 61 73 65 20 27 76 27 3a |reak;..c|ase 'v':|
|000050a0| 20 63 3d 27 5c 76 27 3b | 20 62 72 65 61 6b 3b 0d | c='\v';| break;.|
|000050b0| 09 63 61 73 65 20 27 66 | 27 3a 20 63 3d 27 5c 66 |.case 'f|': c='\f|
|000050c0| 27 3b 20 62 72 65 61 6b | 3b 0d 09 63 61 73 65 20 |'; break|;..case |
|000050d0| 27 61 27 3a 20 63 3d 27 | 5c 61 27 3b 20 62 72 65 |'a': c='|\a'; bre|
|000050e0| 61 6b 3b 0d 09 63 61 73 | 65 20 27 78 27 3a 20 63 |ak;..cas|e 'x': c|
|000050f0| 3d 73 74 72 74 6f 6c 28 | 73 2c 26 73 2c 31 36 29 |=strtol(|s,&s,16)|
|00005100| 3b 20 62 72 65 61 6b 3b | 0d 09 63 61 73 65 20 27 |; break;|..case '|
|00005110| 30 27 3a 20 63 61 73 65 | 20 27 31 27 3a 63 61 73 |0': case| '1':cas|
|00005120| 65 20 27 32 27 3a 20 63 | 61 73 65 20 27 33 27 3a |e '2': c|ase '3':|
|00005130| 63 61 73 65 20 27 34 27 | 3a 20 63 61 73 65 20 27 |case '4'|: case '|
|00005140| 35 27 3a 63 61 73 65 20 | 27 36 27 3a 20 63 61 73 |5':case |'6': cas|
|00005150| 65 20 27 37 27 3a 0d 09 | 09 63 3d 73 74 72 74 6f |e '7':..|.c=strto|
|00005160| 6c 28 73 2d 31 2c 26 73 | 2c 38 29 3b 20 62 72 65 |l(s-1,&s|,8); bre|
|00005170| 61 6b 3b 0d 09 64 65 66 | 61 75 6c 74 3a 20 63 3d |ak;..def|ault: c=|
|00005180| 73 5b 2d 31 5d 3b 20 62 | 72 65 61 6b 3b 0d 09 7d |s[-1]; b|reak;..}|
|00005190| 0d 09 2a 73 50 74 72 3d | 73 3b 0d 09 72 65 74 75 |..*sPtr=|s;..retu|
|000051a0| 72 6e 20 63 3b 0d 7d 0d | 00 00 00 00 00 00 00 00 |rn c;.}.|........|
|000051b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000051c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000051d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000051e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000051f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005200| 00 00 01 00 00 00 01 6e | 00 00 00 6e 00 00 00 3e |.......n|...n...>|
|00005210| 75 73 7d 20 21 3d 20 30 | 0d 09 09 45 78 69 74 20 |us} != 0|...Exit |
|00005220| 7b 4d 79 53 74 61 74 75 | 73 7d 0d 09 65 6e 64 0d |{MyStatu|s}..end.|
|00005230| 11 52 65 61 64 41 73 73 | 69 67 6e 6d 65 6e 74 73 |.ReadAss|ignments|
|00005240| 2e 63 02 00 00 00 54 45 | 58 54 4b 41 48 4c 00 00 |.c....TE|XTKAHL..|
|00005250| 00 00 54 45 58 54 4b 41 | 48 4c 00 00 00 00 00 00 |..TEXTKA|HL......|
|00005260| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005270| 00 00 a7 e5 d5 c6 00 00 | 00 00 00 00 01 ac 22 60 |........|......"`|
|00005280| 09 09 09 09 23 20 73 65 | 65 20 69 66 20 77 65 20 |....# se|e if we |
|00005290| 6e 65 65 64 20 74 6f 20 | 63 6f 70 79 2f 70 61 73 |need to |copy/pas|
|000052a0| 74 65 20 6f 72 20 6a 75 | 73 74 20 63 75 74 0d 09 |te or ju|st cut..|
|000052b0| 28 45 76 61 6c 75 61 74 | 65 20 7b 73 65 6c 43 68 |(Evaluat|e {selCh|
|000052c0| 61 72 73 7d 20 3d 7e 20 | 2f 28 5b 30 2d 39 5d 2b |ars} =~ |/([0-9]+|
|000052d0| 29 a8 31 2c 28 5b 30 2d | 39 5d 2b 29 a8 32 2f 20 |).1,([0-|9]+).2/ |
|000052e0| 29 20 b7 20 64 65 76 3a | 6e 75 6c 6c 0d 09 69 66 |) . dev:|null..if|
|000052f0| 20 7b a8 31 7d 20 3d 3d | 20 7b a8 32 7d 0d 09 09 | {.1} ==| {.2}...|
|00005300| 00 00 00 48 00 09 4d 6f | 6e 61 63 6f 00 20 72 75 |...H..Mo|naco. ru|
|00005310| 6e 74 69 6d 65 20 43 20 | 69 6e 74 65 72 70 72 65 |ntime C |interpre|
|00005320| 74 65 72 20 74 68 00 06 | 00 04 00 50 00 20 01 dd |ter th..|...P. ..|
|00005330| 02 3d 00 50 00 20 01 dd | 02 3d a6 a4 f7 82 00 00 |.=.P. ..|.=......|
|00005340| 17 67 00 00 17 67 00 00 | 16 46 01 00 00 00 00 1e |.g...g..|.F......|
|00005350| 00 50 00 20 01 dd 02 3d | 00 50 00 20 01 dd 02 3d |.P. ...=|.P. ...=|
|00005360| 00 00 16 46 00 00 00 00 | 00 00 00 00 00 00 00 00 |...F....|........|
|00005370| 01 00 00 00 01 6e 00 00 | 00 6e 00 00 00 3e 00 d4 |.....n..|.n...>..|
|00005380| 1c 60 05 e2 00 00 00 1c | 00 3e 00 00 4d 50 53 52 |.`......|.>..MPSR|
|00005390| 00 01 00 0a 03 ed ff ff | 00 00 00 00 00 00 00 00 |........|........|
|000053a0| 03 f0 ff ff 00 00 00 4c | 00 00 00 00 00 00 00 00 |.......L|........|
|000053b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000053c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000053d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000053e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000053f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+